JSplitPane with JTree/JTable 1 mouse click update problem

From: Joost Kraaijeveld (J.Kraaijeveld_at_Askesis.nl)
Date: 01/25/05

  • Next message: Andrew Thompson: "Re: JSplitPane with JTree/JTable 1 mouse click update problem"
    Date: Tue, 25 Jan 2005 08:30:48 +0100
    
    

    I have a JSplitPane with a JTree on the left and a JTabbedPane on the
    right. I want the JTabbedPane replaced, based on the actual type of the
    object that is clcked.

    That works OK but the following happens:

    On the first time click on an object in the tree, the JTabbedPane
    appears but only half filled. The second time I click (without changing
    the object in the tree), the JTabbedPane appears fully filled.

    Exactly the same code is executed:

    if(e.getClickCount() == 1)
    {
    DefaultMutableTreeNode selectedObject =
    (DefaultMutableTreeNode)selPath.getLastPathComponent();

    if( selectedObject.getUserObject() instanceof RootNode)
    {
       RootTabbedPane tabbedPane = new RootTabbedPane();
       splitPane.setRightComponent(tabedPane }
    else if( selectedObject.getUserObject() instanceof IntermediateNode)
    {
       IntermediateTabbedPane tabbedPane = new IntermediateTabbedPane();
       splitPane.setRightComponent(tabedPane }
    }

    Can anyone give me an idea on how to solve this problem?

    TIA

    Joost


  • Next message: Andrew Thompson: "Re: JSplitPane with JTree/JTable 1 mouse click update problem"