Previous Next        Current Page: NeXtMidas User's Guide / Applets and WebStart / Applets / Applets (Advanced)
FAQs   
Release Information   
Getting Help   
Basic Concepts   
Result Parameters   
XML Support   
Files   
System Operation   
Macros   
Applets and WebStart   
   - Applets   
      - Applets (Advanced)   
      - Macros in Applets   
   - WebStart   
Graphics   
X-Midas Interoperability   
Third-Party Compatibility   
Installation and Customization   
Running NeXtMidas Independently   
Glossary   


Advanced Use of Applets

Sending messages to your Applets is done using JavaScript through the Document Object Model (DOM).

Look at this simple example which opens a NeXtMidas plot inside a web page:

<applet codebase=".." archive="jars/nxm-sys.jar" code="nxm.sys.libg.MApplet"
        name="MyNeXtMidasApplet" width="100%" height="70%"
        alt="Your browser understands the <APPLET> tag but isn't
             running the Java applet (is Java enabled in your preferences?)">
  <param name="WIN" value="DEMOWIN">
  <param name="CMD" value="PLOT/WIN=DEMOWIN/EXIT=0 world|sv1|sv2|alaska">
  Your browser is completely ignoring the <APPLET> tag or
    you don't have the Java Plug-in installed/setup for your browser.
</applet>

To update this plot, an HTML form is used with its action directed to the plot (via the DOM).

For example, to add a button to the above plot which adds an additional file to the plot:

<form action="" name="OpenCloseFiles">
  <input type="button" name="open_sv3" value="Open sv3"
    onClick='document.MyNeXtMidasApplet.msg("OPENFILE",0,"nxm.sys.dat.sv3{layer={color=red}}")'>
</form>

For more examples of using Messages with Applets, see the nm-plot-page.html example in $NMROOT/htdocs.