javaswinguser-interfacejtoolbar

Is there a way to create JToolBar (floating) on start?


I want to create a JToolBar without adding it into any JFrame window. If I have to add it, then how can I make it such that the toolbar is created as a floating toolbar not a docking toolbar?


Solution

  • you are going to need to override BasicToolBarUI and set the toolbars parent to an instance of JDialog which is bound to the current frame, that way you can float a toolbar by default and keep it on top of the frame.