Referencing

Discussion in 'Java' started by VD, Feb 20, 2004.

  1. VD

    VD Guest

    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.
     
    VD, Feb 20, 2004
    #1
    1. Advertising

  2. VD

    ak Guest

    > 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.
     
    ak, Feb 20, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. K. Shier
    Replies:
    6
    Views:
    532
    K. Shier
    Oct 10, 2003
  2. geoffrey wall

    vhdl source cross-referencing tool

    geoffrey wall, Jul 1, 2005, in forum: VHDL
    Replies:
    7
    Views:
    2,051
    Ajeetha
    Jul 7, 2005
  3. John
    Replies:
    2
    Views:
    390
    David Waz...
    Jul 8, 2003
  4. Mark Friedman

    Referencing subcontrols within UserControl

    Mark Friedman, Jul 9, 2003, in forum: ASP .Net
    Replies:
    4
    Views:
    400
    Christopher Young
    Jul 14, 2003
  5. William F. Robertson, Jr.

    Re: Referencing Custom Page Class within a Control

    William F. Robertson, Jr., Jul 10, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    391
    Cheung, Jeffrey Jing-Yen
    Jul 10, 2003
Loading...

Share This Page