Back

Java Applets

This example shows how to convert FSEM experiments into Java Applets. The NormalWindow class in the psychWithJava package simplifies converting FSEM experiments using the FullScreen class into Java Applets. See also the Normal Window example and NormalWindow in the API documentation.

HPApplet

This is the Applet version of the HelloPsychophysicist example. Rather than a local application capturing the whole screen, it can be imbedded in a web page. It does not capture the whole screen. Displays a line of text and two images on a black background. A re-play button ("Play Again") is placed near the bottom of the Applet.

Precompiled Applet

Precompiled Applet is in HPApplet.html. Your browser can run it directly (if you have an installed plugin to view Java applets). Alternatively, you can save the file on your local disk and run it from a terminal (MS DOS prompt) with the command appletviewer HPApplet.html. Note that running the Applet doesn't require installing the psychWithJava package.

Files needed to build the project

Building and deploying the Applet project

  • Save the required files in a directory.
  • Build and precompile the project as described in HelloPsychophysicist under "Building and running the project" title.
  • Generate the archive HPApplet.jar following the instructions here (Note: you need to import/extract the NormalWindow.class/NormalWindow.java from the psychWithJava package.) Also note that Applets don't have a Main method. Therefore you don't have to specify a Main-class while generating the archive. If you are using command line tools, you shouldn't have a line like Main-class: HelloPsychophysicist. Similarly, if you are using Eclipse, don't specify a Main class at the final step as was shown here for the HelloPsychophysicist project.
  • Deploy the applet by opening the HPApplet.html page in your browser. Alternatively you can fire the command appletviewer HPApplet.html to run the Applet.
  • Another alternative to deploy is issuing appletviewer HPApplet.java command. This is possible because HPApplet.java has the following lines near the top
    // <applet code="HPApplet.class" archive="HPApplet.jar" width=750 height=612>
    // </applet>
    
  • See also http://java.sun.com/docs/books/tutorial/deployment/applet/deployindex.html

Description of the project

  • Pure Java version Coming soon...(see the comments in the code for now)
  • No Matlab or Mathematica version