Procedure
Basic Visual
Editor Test
This test will
demonstrate the creation of a simple Swing graphical application using
the Visual Editor.
Creating Project
First create a new
Java Project by pressing the New button on the toolbar.
Select Java from the
list on the left, and Java Project on the right.
Click Next, and name
the project VE Demo and click Finish.

Creating Visual
Class
Once the project is
created, select it in the Package Explorer, then mouse button 2 and
from the New menu, select Visual Class.

In the wizard, name
the new class SayHello, ensure the Frame and Swing
buttons are checked and click Finish.
The Visual Editor
will now launch with a JFrame on the canvas.
Initial Editing
Select the JFrame by
clicking on it on the canvas. A black border will indicate it's
selected.
Move the mouse to
the lower-right of the JFrame and click and drag the edge to a larger
size, as the picture shows.

Once the JFrame is
resized properly, click on it again to Direct Edit the title of the
frame. Enter "Say Hello"
into
the white box that pops up, and press enter when done.

The title of the
frame will change to reflect the new text.
Adding the
Control Panel
On the palate (gray
bar on the left of the canvas) click on the Swing Containers drawer.
Select JPanel
from that drawer
then move the cursor over the lower portion JFrame on the canvas.
When the South area
becomes highlighted,
click to drop the JPanel.

Next, open the Swing
Components drawer again on the palate and select JLabel. Move the
cursor to the narrow
box at the bottom of
the JFrame and click. The JLabel will be dropped into the panel
at the bottom of the frame.
Click on the JLabel
on the canvas again to bring up the Direct Edit box. Change the
text to say "Enter your name:".
In the Swing
Containers drawer on the palate, choose the JTextField bean. Move
the cursor back over to the canvas
to the right of the
JLabel. A vertical black line indicates where the new bean will
be dropped. Click to drop the text field.
The new text field
is very small on the canvas. To make it bigger, while the text
area is selected go to the Properties view
on the far right and
click on the columns property. Enter the number 10 and press
enter. The text field on the canvas
will be a more
respectable size.

Next, select JButton
on the palate and drop it to the right of the text field. Bring
up Direct Edit on the button and change
its text to "Say
Hello"
Creating Greeting
Text
Choose another
JLabel from the palate. Move the cursor over the center of the
JFrame until the center region is
highlighted and
click to drop. The greeting should be centered on the window.
With the label selected, go to the
property sheet and
change the horizontalAlignment property to CENTER.

Next the font size
should be increased to make it show up better. Select the font
property on the property sheet,
and press the gray
... button on the right to bring up the font property editor.
Change the size of the font to 36 by
selecting the number
from the size list and press OK.

To change the label
text's color, select the foreground property on the property sheet,
then press the gray ... button
to launch the color
property editor. Select the Named Colors tab at the top of the
editor, then choose blue from the
basic colors list
and press OK.
Next the initial
label text has to be changed from "JLabel" to nothing (so the program
will start out without a greeting.)
Select the text
property on the property sheet, then push the "Restore Default Value"
button at the top of the property
sheet. This
will clear the label's text value.

Adding Event
To make the program
actually do something, an event needs to be added. Select the
"Say Hello" button on the canvas.
Mouse button two to
bring up the context menu, go down to Events, and select
"actionPerformed". This will add an
event which will
occur when the button is clicked.

In the source code
pane, look for the line of code:
System.out.println("actionPerformed()");
// TODO Auto-generated stub actionPerformed()
Remove that line
from the source, and replace it with the following line:
jLabel1.setText("Hello " + getJTextField().getText());
When you are finished, your applicaton should look something like this:
Running the Application
That's all that is
needed to create the application. Save the file, then go to the
Run menu, then go to the Run As
sub menu, and select
Java Bean

Expected
Results
The application will
be launched. Enter a name into the text field at the bottom and
click the Say Hello button.
This simple
application has been successfully created.
