|Current Page: NeXtMidas User's Guide Third-Party Compatibility NetBeans|
Using NetBeans with NeXtMidas
This section explains how the NetBeans GUI builder creates new panel definitions for existing macros. For an introduction on using JavaBeans to create panels in NeXtMidas, go to JavaBeans.
NetBeans is a "free and open source... integrated development environment for Java Software Developers" sponsored by Sun Microsystems. NetBeans can be downloaded, free of charge, in one of two ways:
(Most users find that downloading and installing the bundled version is easiest.)
When the installation is complete, make a note of the command provided in the
install window. This command starts NetBeans (on RedHat Linux, it may be
NeXtMidas comes with two new Swing widgets that embed plots and other NeXtMidas displays in GUIs created with NetBeans. These steps register the NeXtMidas widgets:
Always repeat these registering instructions after installing a new NeXtMidas release to guarantee the most current NeXtMidas widgets.
The first step in creating a GUI for an existing macro is establishing a NetBeans project for the macro's option tree:
After a project is made for the appropriate option tree, you can create a new GUI form:
Once the form is created, it can be edited. If the form is not opened, double click the icon under the projects tab on the left of the screen.
The form editor has two buttons: "Source" and "Design." The "Source" button brings up the Java source for the form (use this only if you are doing something more advanced in Java). The "Design" button brings up a graphical form editor.
On the right of the form editor, there are three windows: the Palette lists all available widgets (NeXtMidasControls and NeXtMidasDisplay widgets are at the bottom of the Swing palette); the Introspector shows the relation between the various widgets in the form; and the Properties list allows you to set/modify the widget properties.
There are three buttons at the top of the Properties window -- one for each property type:
Usually, the first step is setting the form layout. Right-click on the form and select Set Layout. Choose a layout ("AbsoluteLayout" is usually a good one to start with).
To add a widget to hold a NeXtMidas plot, select the MidasDisplay from the
Palette and click on the form where the display should go. Once the
display is in position, select the display (click on it). In
the Properties window, enter the ID of the NeXtMidas plot as the "Variable
Name" (e.g., if the line in the macro defining the plot looks like
The MidasControls widget is a special widget that displays the controls
To test the form, save it, enter NeXtMidas, and try the
following (substitute the name of your macro for
nM> path add map nM> bld geoplot.java mcr map nM> geoplot/jsetup
When you run a macro with the
As far as the macro is concerned, this is little different than using an
alternate setup file for the panel (such as using
Java facilities allow
Make a Button Group
In a macro, it is possible to use a set of buttons that work together using the following:
gc button state "" "Run,Pause,Exit" 1
To have the same effect when using the GUI builder, create a ButtonGroup with the variable name "state." Next, create three buttons ("Run," "Pause," and "Exit"), and highlight the three buttons. Under "Properties," set "buttonGroup" to "state."
Note: Since "Variable Name" is the only text used while communicating with
the macro, these buttons have user-friendly text and a helpful "toolTipText"
set (unlike buttons created with