I am developing an app that has several tabs in a JTabbedPane. When a tab is selected I want a tab specific toolbar to be added to a panel 'toolPanel' and then removed when the tab is deselected.
I have implemented a tablistener that adds and removes the toolbars and this works fine unless the user has dragged the toolbar off the toolPanel. In that case the toolbar is still removed but the title of its JToolBar window is still there and can only be got rid of by clicking the close-window control. I can make the toolbar not floatable but I dont want to.
This code is run when a tab is activated
this code is run when the tab is deactivated
Is there a better way of doing this and how do I get rid of the floating toolbars frame ?
I am using JSE6.