Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JToolBar problem  RSS feed

Dávid Kéri
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey all!

I got a weird JToolBar problem. I checked the other threads about JToolBars, but didn't have any luck solving the problem.

So basically I have a GUI class, which starts the application, initializes a JFrame, tosses in a JMenuBar, and two JToolBars. Plus there is a JPanel for Java3D canvas painting. This is achieved by calling the setContentPane() method on my JFrame.

Now, when I want to change the painted item on the canvas, I call the setContentPane() again (from a different class), and it works fine, my 3d image is ready. But everything else vanishes. Now to counter that, I remake all the menubars again. This seems to work, only problem is when a JToolBar is floating, and I remake the whole stuff, then the floating one stay in it's spot (with another one sitting on the original spot).

I know it's not the best way I have done, but I had no any other idea. I tried using remove() or setVisible(false) on the "original" JToolBar, without any luck.

I'll attach the code and a few pictures, in case someone can help me .

This is the code of my GUI class, which starts the application.

And the following is a JDialog, from which I update the whole stuff.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!