Previous Next        Current Page: NeXtMidas Training / Eclipse - 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)   
NetBeans - Part 3 (Profiler)   
Eclipse - Part 1 (Setup)   
Eclipse - Part 2 (GUIs)   
   - Using the GUI Builder   
      - How Does it Work?   
      - Demo   
         - Step 1 - Create GUI Form   
         - Step 2 - Edit GUI Form   
         - Setting up the GUI Builder   
            - Step 1   
            - Step 2   
            - Step 3   
            - Step 4   
         - Step 3 - Add Widget   
         - Step 4 - Add Widget Cont.   
         - Step 5 - Final Layout   
         - Step 6 - Using GUI Form   
      - Do I need a macro?   
   + Lab1   
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, 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.