Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

MouseListener to JTable  RSS feed

sabbir kazi
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was trying to activate a JDialog box when user double-clicks on any JTable cell. I have added a MouseListener to the JTable but it does not work. The code excerpt is as folows:
studentTableModel.setDataVector(studentData, columnNames);

studentTable.addMouseListener ( new MouseAdapter()
public void mouseClicked(MouseEvent me)
if (me.getClickCount() == 2)
Pointp = me.getPoint();
int row= studentTable.rowAtPoint(p);
int col= studentTable.columnAtPoint(p);

String userIDSelected = (String) studentTable.getValueAt(row, 1);

// open a JDialog to show the student status

dialogStatus = new myDialog(dialog, "Kazi", "Number");;

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!