aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes JTable... Urgent! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTable... Urgent!" Watch "JTable... Urgent!" New topic
Author

JTable... Urgent!

Jeff Smith
Ranch Hand

Joined: May 04, 2001
Posts: 50
Hi, I've got a JTable set up to display some data records. I need to be able to get the value at a cell when the user clicks that cell. I can add a MouseListener to the table, but the problem is all it tell's me is that the user clicked somewhere, but has no idea what the row or column of the cell was, how would I go about getting that? Oh, by the way, the table is not editable, and allows only single, non-row, selections.
Thanks,
Jeff
Paul Stevens
Ranch Hand

Joined: May 17, 2001
Posts: 2823
In your mouse event code put in this:
Point pnt = evt.getPoint();
int row = table.rowAtPoint(pnt);
int col = table.columnAtPoint(pnt);
Jeff Smith
Ranch Hand

Joined: May 04, 2001
Posts: 50
Thanks, that's exactly what I needed.
Jeff
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JTable... Urgent!
 
Similar Threads
JTable
JTable(!!!)
JTable
JTable
jtable