{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-guides/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Customizing The Toolbar Walkthrough","description":"Accelerate E&P application development and protect your innovation by consuming our Data and Domain APIs / Platform APIs.","lang":"en-US","meta":[{"name":"robots","content":"noindex"}],"llmstxt":{"hide":false}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"customizing-the-toolbar-walkthrough","__idx":0},"children":["Customizing The Toolbar Walkthrough"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["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."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"reviewing-dependencies","__idx":1},"children":["Reviewing Dependencies"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The customization of the toolbar requires one INT module that is part of the INTViewer platform:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["IntviewerCore"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["See the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/solutions/intviewer/intviewer-platform-and-modules"},"children":["list of INTViewer modules"]}," to load the INTViewer platform and for a description of each module."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"creating-your-module-template-using-netbeans-wizard","__idx":2},"children":["Creating your module template using NetBeans wizard"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Click ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["File -> New Project"]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In the New Project wizard select ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["NetBeans Modules"]}," from the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Categories"]}," list and ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Module"]}," from the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Projects"]}," list and click ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Next >"]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Project Name"]},", specify ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["mydemotoolbaritemmodule"]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Select option ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Standalone Module"]}," and make sure to specify the INTViewer platform in the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["NetBeans Platform"]}," field."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Click ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Next >"]}," and specify com.mycompany.myviewer.",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["mydemotoolbaritem"]}," for the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Code Name Base"]},"and ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["MyDemoToolbarItemModule"]}," for the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Module Display Name"]},"."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Check ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Generate XML Layer"]}," (if this option is not present, check the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/solutions/intviewer/intviewer-platform-and-modules/registering-the-layer-xml-file"},"children":["Registering the layer.xml file"]}," article)"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Click on ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Finish"]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Projects"]}," tree view, you should see your project which includes a number of files that have been created for you"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"configuring-your-module","__idx":3},"children":["Configuring your Module"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["In the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Projects"]}," tree, right click on the module ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["MyDemoToolbarItemModule"]}," and select ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Properties"]}," from the list."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Under ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Categories"]},", select ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Libraries"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Select ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Java plaform"]}," ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["JDK1.7"]}," . If you don't see this option, you will need to install jdk1.7 and load it into NetBeans using option",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Tools->Java Platforms"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Click on the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Add"]}," button next to ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Module Dependencies"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["In the list, select ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["IntviewerCore"]}," and click ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["OK"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Click ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["OK"]}," in Project Properties Dialog"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"adding-icons","__idx":4},"children":["Adding Icons"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["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."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["On Windows, you can use Paint to create these two icons quickly. You can use the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Image -> Attributes"]}," dialog box of Paint to control the width and height of your icons."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The name of the ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["derived"]}," icon should be identical to the name of your ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["base"]}," icon, except for the number 24 added before the .PNG extension of your derived icon."]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Drag and drop these two icons from your file system to your module's source package."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"creating-an-action-class","__idx":5},"children":["Creating an Action class"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Projects"]}," tree, right click on the module ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["MyDemoToolbarItemModule"]}," and select ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["New -> Java Class..."]}," from the list."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Enter DemoMenuItemAction as ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Class Name"]}," and select com.mycompany.myviewer.mydemotoolbaritem as ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Package"]},"."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Automatically add an import for ActionListener"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Automatically create the skeleton of required methods for this class"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Customize the actionPerformed method"]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["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."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["More details about ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/solutions/intviewer/intviewer-apis-for-dialogs-and-editors/displaying-dialogs"},"children":["dialog boxes"]}," are available."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"customizing-the-layerxml-file","__idx":6},"children":["Customizing the layer.xml file"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Modify the layer.xml file as follow:"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In this layer.xml file:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["<folder name=\"Actions\">"]}," indicates the start of the list of actions available in the module (do not change this line)"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["<folder name=\"ZoomActions\">"]}," indicates the list of actions in the Zoom toolbar (the name ZoomActions is arbitrary)"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["<file name=\"com-mycompany-myviewer-mydemotoolbaritem-DemoToolbarItemAction.instance\"> indicates a unique name for the icon"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["<attr name=\"delegate\" newvalue=\"com.mycompany.myviewer.mydemotoolbaritem.DemoToolbarItemAction\"/> specifies the action class associated with the icon"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["<attr name=\"displayName\" stringvalue=\"DemoToolbarItemDisplayName\"/> indicates the name of the icon, as see by the end-user"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["<attr name=\"instanceCreate\" methodvalue=\"org.openide.awt.Actions.alwaysEnabled\"/> specifies the class controlling the visibility of the menu item. In this case, it's always visible"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["<attr name=\"noIconInMenu\" boolvalue=\"false\"/> indicates that no other icon is added"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["<folder name=\"Toolbars\">"]}," indicates the start of the list of toolbars customized in the module (do not change this line)"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["<folder name=\"Zoom\">"]}," indicates the name of the toolbar being customized"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["<file name=\"com-mycompany-myviewer-mydemotoolbaritem-DemoToolbarItemAction.shadow\"> indicates a unique name for the icon"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["<attr name=\"originalFile\" stringvalue=\"Actions/ZoomActions/com-mycompany-myviewer-mydemotoolbaritem-DemoToolbarItemAction.instance\"/> indicates the name hierarchy of the icon being added"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["<attr name=\"position\" intvalue=\"0\" /> indicates the position of that icon within its set"]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can download the layer.xml file from the attachments at the bottom this page."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"viewing-your-icon","__idx":7},"children":["Viewing your icon"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["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:"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can switch to the smaller icon using the View/Toolbars menu:"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Here is the same toolbar using the 16x16 icon:"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When clicked, this icon should display this dialog box:"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"adding-separations","__idx":8},"children":["Adding separations"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To separate your icon from other icons, just change the name of your \"folder\" in layer.xml to a folder name that is unused."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["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."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The layer.xml file is automatically updated, a position attribute has been added."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Here is the updated toolbar, with our icon on the far right:"]}]},"headings":[{"value":"Customizing The Toolbar Walkthrough","id":"customizing-the-toolbar-walkthrough","depth":1},{"value":"Reviewing Dependencies","id":"reviewing-dependencies","depth":3},{"value":"Creating your module template using NetBeans wizard","id":"creating-your-module-template-using-netbeans-wizard","depth":3},{"value":"Configuring your Module","id":"configuring-your-module","depth":3},{"value":"Adding Icons","id":"adding-icons","depth":3},{"value":"Creating an Action class","id":"creating-an-action-class","depth":3},{"value":"Customizing the layer.xml file","id":"customizing-the-layerxml-file","depth":3},{"value":"Viewing your icon","id":"viewing-your-icon","depth":3},{"value":"Adding separations","id":"adding-separations","depth":3}],"frontmatter":{"title":"Customizing The Toolbar Walkthrough","pageId":"intviewer-tutorial/using-netbeans-swing-components-walkthroughs/customizing-the-toolbar-walkthrough","seo":{"title":"Customizing The Toolbar Walkthrough"}},"lastModified":"2026-10-22T14:32:05.578Z","pagePropGetterError":{"message":"","name":""}},"slug":"/solutions/intviewer/intviewer-tutorial/using-netbeans-swing-components-walkthroughs/customizing-the-toolbar-walkthrough","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}