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?
posted 11 years ago
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.