File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Spring in Action this week in the Spring 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: 1477
    
    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: 1477
    
    6

Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10451
    
    8

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


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: open new window