CIT 594: Forté Tutorial I, Text-only version
If you want to keep this tutorial on the screen as you step through it, you might prefer this version with pictures. In either case, please don't just follow the steps mechanically; think about what you are doing as you go.
In this tutorial we create a simple applet with one "Swap" button and two text areas. Only one of the text areas is editable. Clicking the Swap button swaps the text between the two areas. Since this is an applet, we use only AWT components.
Start -> Programs -> Course-Specific Software -> Cis -> Forte for Java 3.0 -> Forte for Java CE.
"To get started, choose a task below."Click
AWT Formsand click on
Applet, then on the
FirstApplet, choose a filesystem, then click
File -> Mount Filesystem...from the main menu.
Add local directoryis selected.
Browsebutton next to it.
OK. (Sometimes, nothing appears to happen. Sometimes, it happens anyway. I haven't figured this out yet--maybe it's just very slow.)
Newbutton (or hit Alt-N).
Name:area (not the
Fields:area), change the name
String.(The choice menu only lists primitive types, so you will have to type in the word
""as the initial value.
Next >. button.
init()method, but no others). This is exactly what we want, so without changing anything, click
Finishbutton. (You can close the Welcome window if you like.)
GUI Editingtab. The SourceEditor window disappears, and a fairly small window entitled Form [FirstApplet] appears; it is empty. (If you don't see the window, it may be partially obscured by another window; look around for it.)
AWTtab is selected.
Deleteon the keyboard and click the
Yesbutton on the confirmation dialog. Then try again.)
OKon it), then click in the south Panel (the thin blue rectangle you created in the previous step). A Button labeled
View -> Component Inspector(or type ctrl-8). This brings up the Component Inspector window. You may want to enlarge this window a bit.
button1 [Button]. Be careful not to double-click this text. Pause a second, then click it again. Edit this text to read
swapButton. (Alternatively, click the
Code Generationtab at the bottom of this window, click to the right of the
VariableNamebutton, and change the name there.)
labelfield (where it says
button1), and change
Swap. (If you don't see it, you may be on the wrong tabbed pane--click the
Layoutstab (in the same group of tabs as the
AWTtab), and choose a GridLayout. If you can't tell which this is, pause the mouse over each icon for a second or two until the tool tip appears. Then click in the center of the Form window, on the Panel you just added.
Panel2, then choose
enabledfield, where it says
True. Use the pulldown menu to select
Eventstab at the bottom.
actionPerformedin the left column. Click on the
<none>in the corresponding position in the right column, and choose
swapButtonActionPerformedin the right column, and select the one entry in the drop-down list. This brings up a source code window with the insertion point already positioned in the correct method.
...), click the
Add...button in the pop-up window that appears, and type in the name
swapButtonActionPerformed. Click the
OKbuttons in these two windows.
swapButtonActionPerformedmethod, after the
// Add your handling code here:comment.:
tempString = textArea1.getText(); textArea1.setText(textArea2.getText()); textArea2.setText(tempString);
GUI Editingtab (the tool tip for this icon reads
Execute (F6)), or click F6. Either the applet will appear, or you will get a window containing error messages. If the latter, fix the errors and try again.
Project -> Save Project, or click ctrl-shift-S.
File -> Exitto quit Forté.