Creating a Panel Walkthrough

Reviewing Dependencies

The creation of a panel requires two modules that are part of the INTViewer platform:

  • IntviewerCore
  • Utilities API (provided with Netbeans)
  • UI Utilities API (provided with Netbeans)

The "UI Utilities API" module is required and is not added automatically by Netbeans. If you don't include this module, you will get the following message after compilation:

"package org.openide.awt" does not exist

See the list of INTViewer modules to load the INTViewer platform and for a description of each 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 mydemopreferencesdialogmodule
  • Select option Standalone Module and make sure to specify the INTViewer platform in the NetBeans Platform field.
  • Click Next > and specify com.mycompany.myviewer.mydemopreferencesdialog for the Code Name Base and MyDemoPreferencesDialogModule for the Module Display Name.
  • Click on Finish

  • Register the layer.xml file
  • 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 MyDemoPreferencesDialogModule 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 click OK.
  • In the list, select Utilities API and UI Utilities API and click OK.
  • Click OK in Project Properties Dialog

Creating a Panel class

  • In the Projects tree, right click on the module MyDemoPreferencesDialogModule and select New -> JPanel Form... from the list.
  • Enter DemoPreferencesPanel as Class Name and select com.mycompany.myviewer.mydemopreferencesdialog as Package.
  • Drag and drop a label and a text field from the Palette
  • Right click the label, select Edit Text and enter "Percentage"
  • Right click the text field, select Edit Text and enter an empty string
  • Resize the text field to an acceptable length
  • Right click the label, select Change Variable Name... and enter "_jPercentageLabel"
  • Right click the text field, select Change Variable Name... and enter "_jPercentageField"
  • Click Source
  • Add a getter and setter for the value of the percentage field, as follow:

To use this panel, follow the Adding a new Preference Dialog Walkthrough.