wood burning stoves 2.0*
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 Android Security Essentials Live Lessons this week in the Android 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: 1449
    
    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: 1449
    
    6

Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10171
    
    8

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


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: open new window
 
Similar Threads
java script for open jsp file
open new browser window on click of button.
Open pdf file
eclipse 2.0
Expiring a pdf document in the browser