Online Java Swing Source-Code Generation Service Applet
To give Java developers immediate access to ready to use Swing source code we have
installed this online code-generation service. This service is provided by a
SpeedJG Applet that can be used similarly to the SpeedJG GUI Builder application.
If you want to create GUIs or Swing components on the fly, you can design them with
this Java applet, generate the source code, and copy and paste this code locally into a
Java file of your choice.
It is assumed that you have read, understood and accepted this
service agreement
before using this service.
Restrictions
-
First of all, your browser must be Java enabled. This service requires
a Java runtime version 1.4.x or higher, and we strongly
recommend that your browser uses an original SUN Microsystems Java browser
plug-in.
-
The SUN Java plug-in supports the standard security model, where all
applets run under the standard applet security manager, which prevents
potentially malicious applets from performing dangerous operations, such as
reading local files or spying out your clipboard. For this reason, we have
deactivated any access to the local system when modifying the original
SpeedJG application to be applet-executable:
-
open and store GUI projects;
-
scan for resources like images and XML files with the Resource Dialog;
-
save generated source code into Java files, etc.
But how to copy and paste the generated code from this applet into your Java files?
We have discovered that the current version of the Java plug-in software from SUN
(1.5.x installed on MS-IE) supports CTRL-C to
copy selected text from an applet to the clipboard. This is NOT
done by allowing the applet programmer to access the clipboart, but by
the plug-in itself, so that applets running in this environment are still
secure in that the contents of the clipboard cannot be discovered by the
applet code itself. Thus, if you have installed this plug-in version, it
should not be a problem to use this service.
For those who do not have this version at their disposal, we have developed an
Java applet which is a true copy of the above version with one exception: This version
listens if the user presses CTRL-C while the mouse resides on
the source-code panel. In this case the selected text is copied to the clipboard.
But as this applet is not executable under normal circumstances, we have
signed it with the SUN keytool. Applets modified in such
a manner are executable without any security-checks, but the user will be asked if
he trusts the applet producer before it starts.
There is a third alternative: if you modify your local
{JAVA_HOME}/lib/security/java.policy
file, and include the following security permission:
grant {
...
permission java.awt.AWTPermission "accessClipboard";
...
};
When making this change, all applets running on your system have full access to the
clipboard and you can copy and paste the source code with the un-signed applet-version
of this service as well.
Operating the Java Swing Source-Code Generation Service Applet
This service is adapted from the SpeedJG GUI builder application. Therefore, it is
recommended that you read the documentation available under
Introduction and
How Tos on this page to become familiar with the handling.
Subsequently, you should be able to use this service applet without any trouble.
To make creating your GUIs, forms, dialogs, menus, panels, components, etc. as
easy and convenient for you as possible, we have stored the complete examples project
from the standard SpeedJG download package into the applet .jar file, to make it
available for you. Thus, you can take up one of these components, modify it according
to your needs, and generate the source code.
Last but not least, there are some words to be said about the necessity of the
code line
import speed.jg.*;
residing in the generated code:
-
Every code-generation process generates a complete and ready to use set of classes.
The GUI class, representing the view according to the MVC pattern, extends another
class named
GUIObject. The latter is located in the
SpeedJG.jar file of the original SpeedJG distribution. This
SpeedJG.jar also contains some images used by the examples project.
To make your generated source code run with the images provided in some of the example
GUIs and without making any changes, you have to put either the
SpeedJG.jar from the original distribution, or the
Sun Java look and feel Graphics Repository -
jlfgr-1_0.jar -
on your CLASSPATH. If you don't use any of the images you simply
can delete the import speed.jg.*; entry,
and store the GUIObject.java
file into your project and make it visible to your GUI code.
-
The main task of the
GUIObject class is to store
the different Components in a Hashtable and serve them later on.
Further tasks are to load images and other resources from the
CLASSPATH, serve popup menu controllers and calculate the size
of Components with respect to their containers.
| Starting this Java Swing Source-Code Generating Service Applet |
|
SpeedJG Applet
|
Use this link to start the un-signed default applet.
|
|
SpeedJG SignedApplet
|
Use this link to start the signed applet (with clipboard access).
|