0

I'm working on a GUI that uses Java3D to display previews of 3d models. I have a JTabbedPane wherein each tab is a Canvas3D to allow loading multiple previews and switching between them. This has been working fine until I got around to adding in the functionality to remove tabs. When a tab is removed, most of the time, the remaining tabs stop rendering the 3d models while rarely they will continue working as intended. There is no apparent set of conditions that can determine when the tabs will continue working and when they won't. Loading up a new preview, however, will bring all other tabs right back to life.

Things I've tried:

  • Calling validate on the JTabbedPane
  • Calling invalidate on the JTabbedPane and then validate
  • Calling invalidate/validate on the new currently selected Canvas3D tab
  • Calling repaint() on Canvas3D, JTabbedPane, etc.
  • Calling stopView() startView() on the View object attached to the Canvas3D

Calling isViewRunning() returns true even when it appears it isn't so maybe I'm looking in the completely wrong place for this problem. Any thoughts on this would be very much appreciated.

user34212
  • 21
  • 1
  • 1
    for better help sooner post an [SSCCE](http://sscce.org/) – mKorbel Jul 03 '12 at 21:59
  • The phrase _most of the time_ might prompt a check on [correct synchronization](http://download.oracle.com/javase/tutorial/uiswing/concurrency/initial.html). – trashgod Jul 03 '12 at 22:30
  • @mKorbel Thanks for the tip. Putting together an SSCCE for this seemed it would take more time than it would be worth. Was just hoping some people had run into a similar problem. – user34212 Jul 05 '12 at 22:01
  • @trashgod Thanks, I'm looking into that. It looks like it may be a promising lead. – user34212 Jul 05 '12 at 22:03

1 Answers1

1

Canvas3D tabs render correctly while running my application on 6u33 or 7u5 (Win 7 64). In 'former times', following a workaround hint, I called validate on the top-level component (usually a JFrame) in the JTabbedPane's ChangeListener when a tab was removed.

  • Thanks a lot for the help. The workaround has allowed it to work for all cases except, strangely, the case where I remove the last tab. Removing anything else works perfectly as intended. – user34212 Jul 05 '12 at 21:56