While you are developing your visual class, you can run it to test
its appearance and behavior.
When you run a Java bean or application using the visual editor,
a virtual machine is created that uses the class path specified in the Java
Build Path of the project. The Java bean is then instantiated using its null
constructor.
- If the Java bean is a visual class (is a subclass of java.awt.Component),
an appropriate window is created to host the visual Java bean.
- If the bean is part of or inherits from an AWT Java bean, the window is
a java.awt.Dialog.
- If the bean is a Swing class or inherits from a Swing class, the window
is a javax.swing.JDialog.
- If the bean is an SWT class, the window is an SWT Shell. If the visual
Java bean does not require a window because it itself is one, the Java bean
will be made visible and given a default size after it has been instantiated.
When you run a class as a Java bean or application, a launch configuration
is automatically created. The launch configuration is used to start a virtual
machine that instantiates the class and allows it to be tested. If a launch
configuration already exists for the class you are running, that launch configuration
will be used.
To run a visual class as a Java bean or application:
- Open your visual Java class in the visual editor.
- From the main menu, select one of the following options:
- if your class has a public
static void main(String[]) method.
- if your class has no main method.
A virtual machine that instantiates the class is started, and the
Java bean or application runs on top of the workbench. You can then test the
behavior and performance of your Java class.