This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Problems using JTree and JTabbedPane Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Problems using JTree and JTabbedPane" Watch "Problems using JTree and JTabbedPane" New topic
Author

Problems using JTree and JTabbedPane

Robert Miller
Ranch Hand

Joined: Jun 18, 2004
Posts: 56
I suspect this is an elementary problem, but I haven't found the solution yet. I'm working on a GUI consisting of a JTree on the left side of the frame and one of three tabbed panes in the center. Which of the three is displayed depends on which JTree node is selected. The tabbed pane occupies a panel which has been added to the center of the content pane. The JTree listener removes the current tabbed pane from the panel and adds the next one.

Sometimes this causes the new pane to be displayed, but often it does not. If I resize the window, or temporarily obscure it with another window, the correct pane is displayed, so I know the components are being successfully added to the right containers. For some reason the window is not being repainted. I've tried calling validate() on numerous components but I haven't noticed any difference.

Cany anyone tell me how to fix this?

Thanks,

Robert
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
Your description of what you are doing and what isn't working the way you want is very clear and concise. This part of java is much too wonderful to figure out what you must/might have missed to produce the symptoms you describe. So it's easier to make up something that behaves correctly and (hopefully) does what you want.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problems using JTree and JTabbedPane
 
Similar Threads
JTree + JList in JScrollPane - Out of Sync
GridBagLayout Problem
JTree CellEditor with Combobox and Textfield
JTree and JScrollPane
JTree