
JPT 2.7.0 Applets Page
This site will be updated as additional applets are available.
To execute any applet, click on its screen snapshot. On each applet page, there is a link to the source files.
The MethodsApplet sample illustrates the use of the base
class JPFApplet to enable Java Power Framework in an applet.
This facilty is the most important addition to JPT 2.7.0.
The Methods Applet Sample permits the user to select from 4 buttons.
Paintable objects,
they may be clicked or dragged with the mouse.BufferedImage
that is used the paint the background of the graphics window. This grid
appears to be underneath the two filled shapes as the shapes are dragged
in the window.Here is a snapshot of the EvaluateDouble auxiliary GUI:
Here is a snapshot of the ReverseString auxiliary GUI:
Back to Top
The initial posting of this applet on January 24, 2008 failed due to the fact
that JPT used getDeclaredMethods in class Class.
It turns out that even asking for all declared methods causes a Java
security exception in an applet deployed in a browser. Why this should be so
is something of a puzzle since you have not yet called any methods. It is
also the case that the same code works locally in AppletViewer so as a test
program AppletViewer cannot be trusted.
The classes JPFHelper and JPFPane have been modified
to work around this security issue. Now the method getMethods in
class Class is used instead.
This applet illustrates the fact that the core JPF class JPFPane
may be called by other applications and applets to serve interesting purposes.
This expands the value of the JPF reflection technology beyond the classes
JPF and JPFApplet
The applet will test most methods in the Java String class against
a string that may be specified by the user. The original applet pane has two
areas: an area to enter a multi-line string to be tested and an area to specify
the names of which String methods to test. If no names are given
in this second area, then all possible String methods will be
offered.
Once you enter a String to test in the top area and enter any
method names, you may create a tester by clicking the button
Create String Tester. The button extracts the test string from the
top area and then creates a tester for that string. Since a
String is immutable, if you change the test string you must
create a new tester.
Here is a screen snapshot of the auxiliary GUI created to test any
suitable method in the String class. You can see that you
are given a scrolling list of method names and that if you hover over a
button then the full signature of the method will be shown in a tool tip.
This auxiliary GUI is created by using JPFPane directly
with the test string as its initializer and the method names to test
(if any) as a filter.
Here is the additional auxiliary GUI created to test the method
int indexOf(String).
You may confirm by counting that the index of lazy in
the original test string is indeed 36.
More generally, this example shows that JPFPane may be
used to test Java methods in a manner similar to what JPF
and JPFApplet do for user-defined methods.
Back to Top
The KaleidoscopeApplet is a simulation of a
kaleidoscope using Paintable objects created
from shapes, images, and text. Historically, the concept
of Paintable was defined in order to make this
example possible. In earlier versions of JPT, this code
was available only as an application. We decided to make
this into an applet using our DirectApplet
base class.
Here is a quick summary of the user options. These are also visible in the snapshot below.
N of 180
degrees.
Click on the image to get to a button that will launch Kaleidoscope. Kaleidoscope is launched in its own window since it uses a large amount of screen real estate.
Back to Top