In this example, we will add a new icon to the toolbar, right next to the "Zoom" icons. The action associated with this icon will be a warning dialog box.
The customization of the toolbar requires one INT module that is part of the INTViewer platform:
See the list of INTViewer modules to load the INTViewer platform and for a description of each module.
You need to create two PNG icons, one with a width and height of 16, and another one with a width and height of 24. The 16x16 icon is your base icon, the 24x24 icon is your derived icon.
On Windows, you can use Paint to create these two icons quickly. You can use the Image -> Attributes dialog box of Paint to control the width and height of your icons.
The name of the derived icon should be identical to the name of your base icon, except for the number 24 added before the .PNG extension of your derived icon.
This requires the import of com.interactive.intviewerapi.util.DialogManager. You can download the DemoMenuItemAction.java file from the attachments at the bottom this page.
More details about dialog boxes are available.
Modify the layer.xml file as follow:
In this layer.xml file:
You can download the layer.xml file from the attachments at the bottom this page.
Click the green arrow in the Netbeans toolbar to run your customized INTViewer. Your icon should be immediately visible. In this example, the 24x24 icon is displayed:
You can switch to the smaller icon using the View/Toolbars menu:
Here is the same toolbar using the 16x16 icon:
When clicked, this icon should display this dialog box:
To separate your icon from other icons, just change the name of your "folder" in layer.xml to a folder name that is unused.
Click the green arrow in the Netbeans toolbar to run your customized INTViewer. Our icon has been moved and a separator has been added. Move your toolbar to the desired location to automatically adjust the position number.
The layer.xml file is automatically updated, a position attribute has been added.
Here is the updated toolbar, with our icon on the far right: