java toolbar example

JToolBar is a long sticky button with the corresponding icon usually under the menu, like the toolbar in word, excel has new, open, save, ...
java-toolbar-example
We will run the program as shown above, including 3 buttons new, open, save on the toolbar. When clicked on the buttons, JTextArea will display the corresponding event.

File name: DemoJToolBar.java
java-toolbar-example
Continue DemoJToolBar.java
java-toolbar-example
This toolbar can be placed at the beginning of the bar (paragraph with multiple dots) to drag drop it in horizontal or vertical position. If you want to fix it you use the method toolBar.setFloatable (false); also, you can add other objects such as JTextField, ... to do search bar for example.

The icons new, open, save you to the same package as:
java-toolbar-example
Read more create jmenu java swing example:

Comments