• Post Reply Bookmark Topic Watch Topic
  • New Topic

Action listener for JTable row selection event

 
Douglas Kent
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've searched, but cannot find out how to add an event listener for the user selecting a row of the JTable. I want to update the Flight JComboBox with the Flight when the user selects a row of flight information. Has anyone done this?
 
Thayasaras
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this
Jtable m_table = new JTable();
..........
..........
m_table.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
int row = m_table.getSelectedRow();
int col = m_table.getSelectedColumn();
}
});
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!