I think I was not clear, lemme explain
JFrame frame = new JFrame();
JPanel panel = new JPanel(new BorderLayout());
JToolBar toolbar = new JToolBar();
toolbar.setFloatable( true);
toolbar.add( new JButton("Open"));
toolbar.add( new JButton("New"));
panel.add( toolbar, BorderLayout.NORTH);
panel.add(...);
frame.add( panel, BorderLayout.NORTH);
frame.setVisible( true);
Then, in a action handler,
panel.setVisible( false);
When the frame is visible, click and drag the toolbar so that the
toolbar appears in its own window.
This hides only the panel, button the toolbar remains in its own
window.
toolbar.setVisible( false); hides only the buttons on toolbar, but the
window( which appears when its dragged out of its place) is still
visible.
I want to show a different panel, when a particular event happens, for
which I have to hide the current toolbar. But it is not happening when
I drag the toolbar and make it appear(float) in its own window
Hope I am clear now