JTable Click Row

Hi,

I have a Jtable that displays a resultset from a database query.

Is it possible to code it so that when the user clicks on one of the rows on the table, it will open a new frame?

If so, what approach would be best?

Ive read up on listselection listeners, but not sure if there is just a simple way to do it through a mouse clicked event..

Thanks in advance

[397 byte] By [mag1987a] at [2007-11-27 0:23:46]
# 1

When you design an application you need to be able to do your action in two ways:

a) by using the mouse

b) by using the keyboard

So you don't use a selection listener because when you use the arrows on the keyboard you would be selecting every row as you move down the table. The normal design would be to display the dialog on a mouse double click or by using the Enter key on a selected row.

Check out this example of the above approach using a JList. The concept should be the same for a JTable:

http://forum.java.sun.com/thread.jspa?forumID=57&threadID=626866

camickra at 2007-7-11 22:19:49 > top of Java-index,Desktop,Core GUI APIs...