| Home | » | Java | » | Advance Java | » | Java Swing II | » | JToolBar |
|---|
A JToolbar contains a number of components whose type is usually some kind of button which can also include separators to group related components within the toolbar. The toolbar can be docked against any of the four edges of a container (panel or a frame). A toolbar can also be made to float.
Toolbars uses BoxLayout, which arranges components in one horizontal row/ vertical column. This layout manager does not force each component to have the same height or width; instead, it uses their preferred height or width, and attempts to align them.
You can adjust the resulting alignment by calling class Component's methods setAlignmentX() and/or setAlignmentY() on each component.
JToolBar Constructor
JToolBar()Creates a new tool bar; orientation defaults to HORIZONTAL.
JToolBar(int orientation)
Creates a new tool bar with the specified orientation.
JToolBar(String name)
Creates a new tool bar with the specified name.
JToolBar(String name, int orientation)
Creates a new tool bar with a specified name and orientation.
Simple Example of JToolBar in Java Swing.
C:\>jdk1.4\bin>javac JToolBarDemo.java
C:\>jdk1.4\bin>java JToolBarDemo
|
||
|
Download Complete Program |

