Previous Next        Current Page: NeXtMidas Training / NetBeans - Part 2 (GUIs) / Using the GUI Builder / Demo / Step 4 - Add Widget Cont.
Start Here   
Background   
Common Midas Concepts   
Getting Started - Part 1   
Getting Started - Part 2   
Working with Files   
Option Trees   
Macros - Part 1 (Basics)   
Macros - Part 2 (Graphics)   
NetBeans - Part 1 (Setup)   
NetBeans - Part 2 (GUIs)   
   + Setting up the GUI Builder   
   + Matisse   
   - Using the GUI Builder   
      - How Does it Work?   
      - Demo   
         - Step 1 - Create GUI Form   
         - Step 2 - Edit GUI Form   
         - Step 3 - Add Widget   
         - Step 4 - Add Widget Cont.   
         - Step 5 - Final Layout   
         - Step 6 - Using GUI Form   
      - Do I need a macro?   
   + Lab1   
NetBeans - Part 3 (Profiler)   
Eclipse - Part 1 (Setup)   
Eclipse - Part 2 (GUIs)   
Primitives   
Applets & WebStart   
Maps & Imagery   
X-Midas Interoperability   
RMIF & Remoting   
Installing NeXtMidas   
Support & Maintenance   
File Handlers   


  • 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, create a ButtonGroup from the Palette window and rename the widget'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 widget to state to let NeXtMidas pass messages from that button group to the processMessage prodcedure in our macro.
    3. Next 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.
    4. Rename the variable of the JButton widget to match the GCONTROL button name. Right-click and select Change Variable Name and enter exit. You should also rename the text of the button, right-click and select Edit Text and enter Exit for the exit button. The button text does not need to match the button variable name and can have more user-friendly text and helpful "toolTipText".
    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. Select the button on the form, then on the button's Properties window change the buttonGroup property to the state ButtonGroup.
      Click image for larger view.