Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Table Cell Renderer  RSS feed

 
Jeremy Hooie
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a custom class which extends JButton and implements TableCellRenderer. When the user clicks on a table cell (button), I want to open a new window. Can I use the ActionListener from JButton, or do I have to use a MouseListener?
 
Paul Stevens
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check example 2 at this site: http://www2.gol.com/users/tame/swing/examples/SwingExamples.html It creates a cell editor and does the processing there. One thing to be aware of. When user double clicks, this will create 2 windows one after the other.
Put your logic in the fireEditingStopped() method.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!