Integer[][] data = new Integer[][] {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
String[] columns = new String[] {"First", "Second", "Third"};
final JTable table = new JTable(data, columns);
table.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
int row = table.rowAtPoint(e.getPoint());
int col = table.columnAtPoint(e.getPoint());
int realCol = table.convertColumnIndexToModel(col);
Object value = table.getValueAt(row, realCol);
System.out.println(value);
}
});
I was about to help and give you a simple solution, but then I realized you have never appreciated the help you have received in the past so I won't bother wasting my time this time:
http://forum.java.sun.com/thread.jspa?threadID=5153697
http://forum.java.sun.com/thread.jspa?threadID=5178175
http://forum.java.sun.com/thread.jspa?threadID=5162875
http://forum.java.sun.com/thread.jspa?threadID=5156296
http://forum.java.sun.com/thread.jspa?threadID=5155648
just to list a couple...