Adding a Viewer Window Walkthrough

ILayeredWindow and IWindow3D objects can be used for most visualization needs. In some cases, a custom window component needs to be implemented. In this example, we will create a window with the content "Hello World", and open this window upon the activation of a menu item.

This tutorial relies on the com.interactive.intviewerapi.windows.AbstractViewerWindow class.

The window created will be visible inside the desktop area. For a window along the desktop area, follow this other tutorial.

Reviewing Dependencies

The implementation of a window requires one INT module that is part of the INTViewer platform:

  • IntviewerCore
  • Lookup API (a NetBeans module)

Creating your module template using NetBeans wizard

  • Click File -> New Project
  • In the New Project wizard select NetBeans Modules from the Categories list and Module from the Projects list and click Next >
  • For Project Name, specify mydemoviewerwindowmodule
  • Select option Standalone Module and make sure to specify the INTViewer platform in the NetBeans Platform field.
  • Click Next > and specify com.mycompany.myviewer.mydemoviewerwindow for the Code Name Base and MyDemoViewerWindowModule for the Module Display Name.
  • Click on Finish
  • Right click MyDemoViewerWindowModule and select New -> XML Layer ...
  • Click Finish
  • In the Projects tree view, you should see your project which includes a number of files that have been created for you

Configuring your Module

  • In the Projects tree, right click on the module MyDemoViewerWindowModule and select Properties from the list.
  • Under Categories, select Libraries.
  • Select Java plaform JDK1.7 . If you don't see this option, you will need to install jdk1.7 and load it into NetBeans using option Tools->Java Platforms
  • Click on the Add button next to Module Dependencies
  • In the list, select IntviewerCore and Lookup API and click OK.
  • Click OK in Project Properties Dialog

Creating a ViewerWindow class

    • In the Projects tree, right click on the module MyDemoViewerWindowModule and select New -> Java Class... from the list.
    • Enter DemoViewerWindow as Class Name and select com.mycompany.myviewer.mydemoviewerwindow as Package.
  • Make this class extend AbstractViewerWindow
  • Automatically add an import for AbstractViewerWindow
  • Automatically create the skeleton of required methods for this class
  • Customize the getAllData method

This requires the import of java.util.List.

  • Right-click Insert Code -> Constructor to override the constructor and enter a display name for the window (My Demo Window in this example)
  • Add a "Hello World" label to this window

This requires the import of javax.swing.JLabel and java.awt.FlowLayout.

You can download the DemoViewerWindow.java file from the attachments at the bottom this page.

Create an Action class

Create a class "DemoViewerWindowAction" in "com.mycompany.myviewer.mydemoviewerwindow" with the following implementation:

A detailed walkthrough to create Action classes and reference them in a layer.xml file is available.

Customizing the layer.xml file

You can download the layer.xml file from the attachments at the bottom this page.

Running your Viewer Window

  • Click the green arrow in the toolbar
  • Open Window > DemoViewerWindow
  • The window is displayed and referenced in the "layers window".