| Author |
JTable and popup
|
Sri Rangan
Ranch Hand
Joined: Dec 08, 2001
Posts: 160
|
|
I have to show a popup menu with the row details when user does not select a row in JTable and right click the mouse. I can detect the right mouse click ny the following code... But how do I find out the row number on the table. Thanks Sri
|
 |
Sri Rangan
Ranch Hand
Joined: Dec 08, 2001
Posts: 160
|
|
I figured it out. row num = table.rowPointAt(new Point(e.getX(),e.getY()));
|
 |
Bhagya Tangutur
Ranch Hand
Joined: Oct 21, 2002
Posts: 88
|
|
You can get the row from Table by calling getRowAt(Point) method.you can get the Point from event.This goes like this.. public void mouseClicked(MouseEvent e){ if(SwingUtilities.isRightMouseButton(e)){ int row= table.getRowAt(e.getPoint()); } }
|
Sun Certified Java Programmer
|
 |
 |
|
|
subject: JTable and popup
|
|
|