Previous Next        Current Page: NeXtMidas Training / Applets & WebStart / Applets Lab / Instructions
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)   
Primitives   
Applets & WebStart   
   - Applets   
   - Applets Lab   
      - Instructions   
      - Solution   
   + WebStart   
   + WebStart Lab   
   - WebStart vs Applets   
Maps & Imagery   
X-Midas Interoperability   
RMIF & Remoting   
Installing NeXtMidas   
Support & Maintenance   
File Handlers   


  • Lab 1:
    • For this lab you will turn the macro you wrote for Lab 3 in the Macros - Part 2 (Graphics) module into an applet.
      • So everyone is on the same page just start by copying the Lab 3 solution and saving it as appletlab.mm and appletlab.mmp into the mcr area of your TRAIN option tree.
        graphicslab3.mm  --> appletlab.mm
        graphicslab3.mmp --> appletlab.mmp
      • Do a quick UPDATE to add APPLETLAB to the dictionary.
      • Then verify that you can run APPLETLAB in the NeXtMidas shell.
    • What you need to do:
      1. Start by copying the the sample Applet page $NMROOT/htdocs/nm-terminal.html to your home directory (you will need to right-click on the link and select "Save Link As..." otherwise it will load the applet). Save the page as xxx_applet.html substituting your initials for xxx.
      2. Edit the page to change the codebase to the relative location of your $NMROOT (this will probably be as simple as "nxmxxx" if NeXtMidas is installed under your home directory.
      3. Append ",jars/nxm-train.jar" to the archive= attribute in the applet tag. e.g.
        <applet codebase="nxmxxx" archive="jars/nxm-sys.jar,jars/nxm-train.jar" code=...>
      4. Build the nxm-train.jar JAR file. You can do this by running...
        nM> make jars train
      5. Load the page in your web browser. It should run a NeXtMidas terminal in the web browser.
      6. Now edit the .html page again...
        1. Add a param definition for "OPTS" that includes your option tree. e.g.
          <param name="OPTS" value="TRAIN,SYS">
        2. Change the value of the "WIN" param tag to be "APPLET_WIN"
        3. Change the value of the "CMD" param tag so that it runs your macro (APPLETLAB) with a /WIN.PANEL=APPLET_WIN switch. This tells the PANEL to attach itself to the applet window.
      7. Reload (e.g. control-refresh) the page in the browser. You should now see your macro running embedded in the browser.
      8. NOTE: You may want to add code to the appletlab.mm macro to allow the "Exit" button to be disabled since the applet exits when the browser window exits. (For example, you can just skip the GCONTROL BUTTON line if the /APPLET switch is set.)
Don't Make This Mistake:
Remember that there are a number of security restrictions on running applets. If you just used your solution to Lab 3 and it was setup to plot maps from a map server, it won't work!