JSplitPane with JTree/JTable 1 mouse click update problem

  • Follow


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
0
Reply J.Kraaijeveld (31) 1/25/2005 7:30:48 AM

On Tue, 25 Jan 2005 08:30:48 +0100, Joost Kraaijeveld wrote:

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

- pack()/validate(), else..
- <http://www.physci.org/codes/sscce.jsp>

HTH

-- 
Andrew Thompson
http://www.PhySci.org/codes/  Web & IT Help
http://www.PhySci.org/  Open-source software suite
http://www.1point1C.org/  Science & Technology
http://www.LensEscapes.com/  Images that escape the mundane
0
Reply Andrew 1/25/2005 8:31:52 AM


1 Replies
245 Views

(page loaded in 0.07 seconds)


Reply: