Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
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
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: 1508
    
    5

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: 1508
    
    5

Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10745
    
    9

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


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: open new window
 
It's not a secret anymore!