This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Swing / AWT / SWT and the fly likes open new window Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "open new window" Watch "open new window" New topic
Author

open new window

alona ariel
Ranch Hand

Joined: Sep 09, 2008
Posts: 36
How to open a new window when we double click on a row in JTable ?

please somebody can give me the code
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1454
    
    6

On the event construct the object of the new window, and call setVisible(true) or show()


Swastik
alona ariel
Ranch Hand

Joined: Sep 09, 2008
Posts: 36
This is a good way to add a mouse listener to a table
?
now how it can open a window?
alona ariel
Ranch Hand

Joined: Sep 09, 2008
Posts: 36
This is a good way do ad a mouse lisener to a table?

public static void main(String args[]) {

JFrame frame = new JFrame("smsll project");
TableModel model = new ColorTableModel();
JTable table = new JTable(model);

TableColumn column = table.getColumnModel().getColumn(3);

table.add(new mouse());




how open a new window with using the mouse
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1454
    
    6

Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10266
    
    8

You can use MouseEvent.getClickCount() to identify double clicks


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
 
 
subject: open new window