{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-guides/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Creating A Topcomponent Window","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":"creating-a-topcomponent-window","__idx":0},"children":["Creating A Topcomponent Window"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"creating-and-manipulating-topcomponent-windows","__idx":1},"children":["Creating and Manipulating TopComponent Windows"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To create a new UI component, use the ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["Window Component Wizard"]},". It creates a UI component that is a subclass of org.openide.windows.TopComponent, that can be opened in the NetBeans main window. This UI component can be treated as a standard Swing container. There is only one TopComponent of each class in the INTViewer desktop. To create javax.swing.JInternalFrame objects, follow this ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/solutions/intviewer/intviewer-tutorial/using-intviewer-components-walkthroughs/implementing-a-window"},"children":["walkthrough"]}," instead."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Creating a new TopComponent window"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Right click the project where you wish to create the new class and chose ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["New | Window Component"]}," to bring up the wizard. In Step 2 of the wizard, select a ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Window Position"]}," from the pull down list. In Step 3 of the wizard enter a ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Class Name Prefix"]}," - the \"TopComponent\" suffix will be added to your Class Name Prefix. For instance, if you supply ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["Example"]},", the final class name will be ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["ExampleTopComponent"]},". Please note, on supplying the class name prefix, the wizard supplies a list of the newly ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Created Files"]}," as well as any ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Modified Files"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["WINDOW POSITIONS"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["explorer - the default position of the NetBeans IDE's Projects window (typically, left side)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["properties - the default position of the NetBeans IDE's Properties window (typically, right side)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["leftSlidingSide - the TopComponent window will be available as a button on the left sidebar"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["rightSlidingSide - the TopComponent window will be available as a button on the right sidebar"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["bottomSlidingSide - the TopComponent window will be available as a button on the bottom bar"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["editor - the default position of the NetBeans IDE's Source Editor window (typically, center) - INTViewer uses this window position so please refrain from selecting this for new top components."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["output - the default position of the NetBeans IDE's Output window (typically, bottom)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["tools - an INTViewer defined mode that will position the window at the lower left (typically where the Navigator window is located)"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["See also: ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"http://wiki.netbeans.org/DevFaqCustomWindowMode"},"children":["wiki.netbeans.org/DevFaqCustomWindowMode"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When you click the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Finish"]}," button on the wizard, all of the newly created files will be opened in the IDE's Editor window. The make the TopComponent class visible to other classes and packages, change the final class to public final class. Add desired graphics to your new component."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Opening a TopComponent window"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To open the new TopComponent window, add a new action. The ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["Action Wizard"]}," will create a new action class and if ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Always Enabled"]}," is selected, will specify that the action will be invoked from a menu item in the menu bar, from a toolbar button in a toolbar, or from a keyboard shortcut anywhere in the IDE. In your new action class, add the following to the actionPerformed method."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"ExampleTopComponent.findInstance().open();\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The default tab position is to the right of all other tabs. You may specify the tab position of your new component. In the following example, the new window tab is placed to the left of all other open window tabs. The requestActive method makes the new window the active window, otherwise the currently active window remains active."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["OPEN NEW COMPONENT"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"public void actionPerformed(ActionEvent e) {\n            ExampleTopComponent window = ExampleTopComponent.findInstance();\n            window.openAtTabPosition(0);\n            window.requestActive();\n}\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Changing position of a TopComponent window"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The mode controls window position and can be reset programmatically by overriding the open method. The following example uses an INTViewer mode named ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["tools"]}," to open the TopComponent window at the lower left corner (where Navigator and Inspector components open in the NetBeans IDE)."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["CHANGING MODE"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":" /**\n  * Opens the top component on the left side of the desktop.\n  */\n@Override\npublic void open() {\n        Mode mode = WindowManager.getDefault().findMode(\"tools\");\n        if (mode != null) {\n                mode.dockInto(this);\n                super.open();\n        }\n}\n"},"children":[]}]},"headings":[{"value":"Creating A Topcomponent Window","id":"creating-a-topcomponent-window","depth":1},{"value":"Creating and Manipulating TopComponent Windows","id":"creating-and-manipulating-topcomponent-windows","depth":2}],"frontmatter":{"title":"Creating A Topcomponent Window","pageId":"intviewer-apis-for-windows/creating-a-topcomponent-window","seo":{"title":"Creating A Topcomponent Window"}},"lastModified":"2026-10-22T14:32:05.576Z","pagePropGetterError":{"message":"","name":""}},"slug":"/solutions/intviewer/intviewer-apis-for-windows/creating-a-topcomponent-window","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}