Results 1 to 4 of 4
  1. #1
    xlomo is offline Member
    Join Date
    Dec 2010
    Posts
    19
    Rep Power
    0

    Default Handling component in multiple Tabs

    Hello forum, I am posting to ask how to handle a Jtree.
    I need to have the same Jtree showing in two different tabs and every change that happens to the first it should happen to the second too.
    Is there any way to connect the Jtrees so that when an event occurs to the jtree in the first tab the same event to be triggered in the second one ? or is there a better solution? Help me please.

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,526
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by xlomo View Post
    Hello forum, I am posting to ask how to handle a Jtree.
    I need to have the same Jtree showing in two different tabs and every change that happens to the first it should happen to the second too.
    Is there any way to connect the Jtrees so that when an event occurs to the jtree in the first tab the same event to be triggered in the second one ? or is there a better solution? Help me please.
    If you want both trees to be equal all the time set the same TreeModel to both JTrees and manipulate that single model.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    xlomo is offline Member
    Join Date
    Dec 2010
    Posts
    19
    Rep Power
    0

    Default

    Thank you for your reply Jos.
    Unfortunately there are more than one tree models that I need to use and they depend on the actions of the user, so I need to have the same events for both trees too, and I need to have the "Selected Path" to be the same. If there is no better way I guess I will have to change the program. but can't I link the trees somehow ?

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,526
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by xlomo View Post
    Thank you for your reply Jos.
    Unfortunately there are more than one tree models that I need to use and they depend on the actions of the user, so I need to have the same events for both trees too, and I need to have the "Selected Path" to be the same. If there is no better way I guess I will have to change the program. but can't I link the trees somehow ?
    Hook up TreeModelListeners to the JTrees and if an event occurs in one tree take the appropriate actions for the other JTrees.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Handling input - multiple keys pressed
    By Shadowstrike in forum Advanced Java
    Replies: 3
    Last Post: 12-30-2010, 01:47 PM
  2. Handling multiple WAV files and saving them into ONE
    By phil128 in forum Advanced Java
    Replies: 2
    Last Post: 12-11-2010, 02:31 PM
  3. setSelectedIndex (How to move between tabs)
    By lolshooter in forum New To Java
    Replies: 4
    Last Post: 02-02-2010, 03:15 PM
  4. Replies: 4
    Last Post: 11-19-2009, 06:03 AM
  5. SWT tabs with Draw2d
    By garyscarter in forum SWT / JFace
    Replies: 0
    Last Post: 07-07-2009, 03:31 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •