Merge pull request #682 from stroudcuster/intro-to-gui
Review of Java tutorial gui-functionality.adoc.
diff --git a/netbeans.apache.org/src/content/kb/docs/java/gui-functionality.adoc b/netbeans.apache.org/src/content/kb/docs/java/gui-functionality.adoc
index 89e046a..1763798 100644
--- a/netbeans.apache.org/src/content/kb/docs/java/gui-functionality.adoc
+++ b/netbeans.apache.org/src/content/kb/docs/java/gui-functionality.adoc
@@ -43,7 +43,7 @@
The first step is to create an IDE project for the application that we are going to develop. We will name our project ``NumberAddition`` .
1. Choose ``File`` > ``New Project`` . Alternatively, you can click the New Project icon in the IDE toolbar.
-2. In the Categories pane, select the Java node. In the Projects pane, choose Java Application. Click Next.
+2. In the Categories pane, select Java with Ant. In the Projects pane, choose Java Application. Click Next.
3. Type `NumberAddition` in the Project Name field and specify a path, for example, in your home directory, as the project location.
4. (Optional) Select the Use Dedicated Folder for Storing Libraries checkbox and specify the location for the libraries folder. See link:http://www.oracle.com/pls/topic/lookup?ctx=nb8000&id=NBDAG455[+Sharing a Library with Other Users+] in _Developing Applications with NetBeans IDE_ for more information.
5. Deselect the Create Main Class checkbox if it is selected.
@@ -89,10 +89,11 @@
1. Double-click `jLabel1` and change the text property to `First Number:`.
2. Double-click `jLabel2` and change the text to `Second Number:`.
3. Double-click `jLabel3` and change the text to `Result:`.
-4. Delete the sample text from `jTextField1`. You can make the display text editable by right-clicking the text field and choosing Edit Text from the popup menu. You may have to resize the `jTextField1` to its original size. Repeat this step for `jTextField2` and `jTextField3`.
-5. Rename the display text of `jButton1` to `Clear`. (You can edit a button's text by right-clicking the button and choosing Edit Text. Or you can click the button, pause, and then click again.)
-6. Rename the display text of `jButton2` to `Add`.
-7. Rename the display text of `jButton3` to `Exit`.
+4. If you want the labels right aligned, as the those in the image are, expand the width of the two shorter labels so that they are all the same width. Then open the Properties dialog for each one, and change the Horizontal Alignment property to RIGHT.
+5. Delete the sample text from `jTextField1`. You can make the display text editable by right-clicking the text field and choosing Edit Text from the popup menu. You may have to resize the `jTextField1` to its original size. Repeat this step for `jTextField2` and `jTextField3`.
+6. Rename the display text of `jButton1` to `Clear`. (You can edit a button's text by right-clicking the button and choosing Edit Text. Or you can click the button, pause, and then click again.)
+7. Rename the display text of `jButton2` to `Add`.
+8. Rename the display text of `jButton3` to `Exit`.
Your Finished GUI should now look like the following screenshot:
@@ -207,7 +208,7 @@
After a few seconds, the application should start.
-NOTE: If double-clicking the JAR file does not launch the application, see xref:../../articles/javase-deploy.adoc#troubleshooting[+this article+] for information on setting JAR file associations in your operating system.
+NOTE: If double-clicking the JAR file does not launch the application, see xref:./javase-deploy.adoc#troubleshooting[+this article+] for information on setting JAR file associations in your operating system.
You can also launch the application from the command line.
@@ -232,7 +233,7 @@
1. Go back to the file `NumberAdditionUI.java` in the Editor. Click the Design tab to see the GUI's layout in the GUI Builder.
2. Right-click any GUI component, and select Events from the pop-up menu. For now, just browse the menu to see what's there, you don't need to select anything.
-3. Alternatively, you can select Properties from the Window menu. In the Properties window, click the Events tab. In the Events tab, you can view and edit events handlers associated with the currently active GUI component.
+3. Alternatively, you can select Properties from the Window/IDE Tools menu. In the Properties window, click the Events tab. In the Events tab, you can view and edit events handlers associated with the currently active GUI component.
4. You can have your application respond to key presses, single, double and triple mouse clicks, mouse motion, window size and focus changes. You can generate event handlers for all of them from the Events menu. The most common event you will use is an Action event. (Learn link:http://java.sun.com/docs/books/tutorial/uiswing/events/generalrules.html#twokinds[+best practices for Event handling+] from Sun's link:http://java.sun.com/docs/books/tutorial/uiswing/events/index.html[+Java Events Tutorial+].)
How does event handling work? Every time you select an event from the Event menu, the IDE automatically creates a so-called event listener for you, and hooks it up to your component. Go through the following steps to see how event handling works.