Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ListSelectionListener in JTable

 
Kevin Tysen
Ranch Hand
Posts: 255
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11021
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use table.getSelectionModel().addListSelectionListener(ListSelectionListener yourListener)
 
Kevin Tysen
Ranch Hand
Posts: 255
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic