This section illustrates you how to create a ToolBar in SWT.
To create a ToolBar , we have used the class ToolBar. The method setBounds() sets the size and location of toolBar. The class ToolItem adds the item to the ToolBar. The SWT.PUSH creates the toolItem in the form of button on the toolBar. The method setText() of this class sets the text to the toolItem. We have used the Listener class to display the selected toolItem on the console.
Here is the code of ToolBarExample.java
Output will be displayed as:
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.