How can I make a floating JToolBar that is always on top?
Created May 4, 2012
If you want to manage floating yourself you could turn of the default floating by calling toolBar.setFloatable(false);. Then add a MouseMotionListener to the JToolBar. React to mouseDrag events. When the drag event followed by a mouse released has it's coordinates outside the area of the JToolBar you could remove it from the frame and add it to a non-resizable, non-modal dialog whose parent is the original application frame. When you show the dialog call pack() on it. The non-modality allows interaction with the main application Frame. The dialog by it's nature floats on the top of the main application Frame. For docking you could do the same thing in reverse way.