- Adding Button widget for control of GUI:
  1. By default, when a GUI form is used, NeXtMidas assumes all the controls are defined. and does not attempt to "re-create" them. To avoid this (and allow `GCONTROL` to create the controls), place a MidasControls widget in the location where the `GCONTROL` should place its controls and give it the variable name of pane0; `GCONTROL` then adds all of its controls on the MidasControls widget when the macro runs.
  2. To use Swing button widgets instead of the MidasControls, first create the Exit button by selecting JButton from the Palette window, then clicking on the place on the GUI form where you want it to be displayed.
     Click image for larger view.
  3. Rename the variable of the JButton widget to match the `GCONTROL` button name. Right-click and select Rename and enter exit. You should also change the text of the button; select the button and in the properties list enter Exit for the exit button's text. The button text does not need to match the button variable name and can have more user-friendly text and helpful "toolTipText".
  4. NeXtMidas uses a ButtonGroup's variable name to match the `GCONTROL` button's name. Since we defined our button as `gcontrol button state "" "Exit"`, we need to name the ButtonGroup state to let NeXtMidas pass messages from that button group to the processMessage procedure in our macro.
  5. The JButton widget has to be associated with the ButtonGroup for NeXtMidas to correlate and automatically pass the button events to the processMessage procedure. Right-click the button in the Structure tree, then choose Set ButtonGroup -> New standard. A (button groups) folder will appear in the Structure pane. Expand it to find the newly created button group. Select it, and in the Properties pane change variable to state.
     Click image for larger view.