Question

I have a program with the main JFrame and a JDialog. Is there any way to make possible move JToolBar between different jPanels,JFrame,JDialor or any other container?

Was it helpful?

Solution

I don't think this is possible.

After digging around the BasicToolBarUI source, when the toolbar is "floated" from it's original window, a reference to the original parent is maintained (dockingSource). When the toolbar is "dropped" into a frame, this is compared and only an instance of dockingSource is accepted as a valid drop target

The only solution that might work in this case would be to create your own UI delegate and override the functionality of the floating process. This is a lot of work, as you would need to, conceivably, provide a delegate for each possible platform...

The only other choice would be to physically remove and add the toolbar manually

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top