In this section of the tutorial, you'll begin building the parts of the Customer Information Window. You'll add labels and fields for the Customer Number, Customer Name, Contact, and Phone and connect those fields to data items in the CUSTOMER record. You'll add a label for the Address panel and Find and Cancel buttons.
See Figure 97 for the placement of these beans. These beans are for the Customer Number label and its corresponding text area. You will need to resize the JTextField because it is small by default.
The Properties window is displayed with properties listed in alphabetical order.
The JLabel now says Customer Number. It may be necessary to resize the JLabel so that all of the text is displayed.
A context menu is displayed.
The Start connection from window is displayed.
The mouse pointer is displayed as
connected to a dashed line. This indicates that you are in the process
of making a connection.
A context menu is displayed.
The End connection to window is displayed.
A blue line is displayed connecting the Customer Number field and the CUSNUM data property in the CUSTOMER record. The description of the connection is displayed in the status area at the bottom of the Composition Editor.
The property-to-property connection window is displayed.
Specifying the keyReleased event for this connection causes the data item CUSNUM in the CUSTOMER record to be updated when the Customer Number field is changed, and causes the Customer Number field (when displayed) to be updated when the data item CUSNUM is changed.
Use the same procedures to create labels and fields for the CUSNAME, CUSCONTACT, and CUSPHONE data items in the CUSTOMER record.
The basic steps you should follow add and connect these parts are:
Complete the following steps to add push buttons to the bottom of your Window.
Tip: | Pressing Ctrl while you select a bean from the Beans palette enables the Sticky feature. Use Sticky to drop more than one of the same type of bean. To turn Sticky off, select another bean or the selection tool. |
Two push buttons are displayed at the bottom of the Window.
The push button is now labeled Find.
Now that you have most of the visual parts of your user interface on the Window, you can use the tool bar to align those parts in the window.