Java Reference
In-Depth Information
Figure 6-18.
Because the CheckboxGroup is a nonvisual component, VE does not “work” well with it. For example, in the
Properties view you can't specify appOptsCBG in the checkboxGroup property value area. (Very strange.) So, we will
have to enter the source code by hand.
12.
In the getEmpAppCB method, add the following code to assign the empAppCB checkbox
to appOptsCBG.
empAppCB.setCheckboxGroup( this .getAppOptsCBG());
13.
Update the getShipAppCB and getSortAppCB methods so the other two checkboxes are
added to appOptsCBG.
All of the checkboxes are now round indicating they are part of a group.
Tutorial: Tying the Frames Together
We now must finish modifying the application so that the AppOptions frame is displayed first. Then, based on the
checkbox selected, the correct application frame will be displayed. In other words, we'll create a new class called TNT
that displays the AppOptions frame. If someone checks the Employee Applications checkbox, we'll then display the
EnterEmpInfo frame.
1.
Create a new Java class called TNT that has a main method.
2.
Enter the code to create an AppOptions object assigned to a variable called ao .
3.
Save the TNT source code and run TNT as a Java application.
Why doesn't anything happen? Because the AppOptions frame's visible property was never set to true, nothing
was displayed.
4.
In AppOptions, set the visible property to true .
5.
In AppOptions, add the source code to reset the Exit button location.
6.
Save the AppOptions source code and run TNT as a Java application.
 
Search WWH ::




Custom Search