aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes ListSelectionListener in JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "ListSelectionListener in JTable" Watch "ListSelectionListener in JTable" New topic
Author

ListSelectionListener in JTable

Kevin Tysen
Ranch Hand

Joined: Oct 12, 2005
Posts: 255
I have a JTable and am trying to get the program to handle changes in the selections in the JTable. If it were a JList, I would just use the addListSelectionListener(ListSelectionListener listener) in the JList class. But there is no addListSelectionListener method in the JTable class. How can I add some kind of selection listener to JTable objects?
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10451
    
    8

Use table.getSelectionModel().addListSelectionListener(ListSelectionListener yourListener)


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Kevin Tysen
Ranch Hand

Joined: Oct 12, 2005
Posts: 255
Thank you.
 
Don't get me started about those stupid light bulbs.
 
subject: ListSelectionListener in JTable