14.11. The JToolBar Component
Swing provides a nice new component not available in the AWT: JToolBar. In the most basic use, JToolBar is little more than a JPanel acting as a container to hold small buttons. However, the main distinction is that JToolBar is dockable (or floatable), meaning that a JToolBar can be dragged out of the original window and kept as a stand-alone window. A JToolBar can also be dragged back into the window or, if originally located at the top, can even be moved to the side of the window.
To build a JToolBar, you simply call the empty constructor (for a horizontal toolbar) or pass in JToolBar.VERTICAL. You typically place a horizontal toolbar in the NORTH or SOUTH region of a container that uses BorderLayout, and a vertical ...
Get Core Web Programming, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.