Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Referencing

Reply
Thread Tools

Referencing

 
 
VD
Guest
Posts: n/a
 
      02-20-2004
Suppose I have defined separate classes by extending JFrame, JTable and and
JTree. I want to place the JTable and JTree in the JFrame. When someone
clicks on an item in the JTree I want the JTable to be updated with some
information based on the selection. What is the best way to do this?
Should a reference to the JFrame be passed to the constructors of JTable and
JTree when they are instantiated? Can a link be made between the JTree and
JTable without doing this?

Thanks.


 
Reply With Quote
 
 
 
 
ak
Guest
Posts: n/a
 
      02-20-2004
> Suppose I have defined separate classes by extending JFrame, JTable and
and
> JTree. I want to place the JTable and JTree in the JFrame. When someone
> clicks on an item in the JTree I want the JTable to be updated with some
> information based on the selection. What is the best way to do this?
> Should a reference to the JFrame be passed to the constructors of JTable

and
> JTree when they are instantiated? Can a link be made between the JTree and
> JTable without doing this?


something like this:

class MyFrame extends JFrame {

JTable table;
JTree tree;

public MyFrame() {
table = new ...;
tree = new ...;

tree.getSelectionModel().addTreeSelectionListener( new
TreeSelectionListener() {
//show data in JTable
});
}
}
--

____________

http://reader.imagero.com the best java image reader.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I connect from/to internal network by referencing it outside static nat? war_wheelan@yahoo.com Cisco 5 01-14-2006 02:14 AM
Can I connect from/to internal network by referencing it outside static nat? war_wheelan@yahoo.com Cisco 0 01-11-2006 05:48 PM
Can I connect from/to internal network by referencing it outside static nat? war_wheelan@yahoo.com Cisco 0 01-11-2006 05:48 PM
vhdl source cross-referencing tool geoffrey wall VHDL 7 07-07-2005 04:48 PM
name-based referencing of collection members? K. Shier ASP .Net 6 10-10-2003 06:09 PM



Advertisments