Java Reference
In-Depth Information
The following steps test the BillPayer window layout managers.
To Test the Layout Managers
1. Compile the program by clicking Tools on the menu bar and then
clicking Compile Java. If TextPad notifies you of errors, click BillPayer.java
in the Selector window, fix the errors, and then compile again.
2. When the program compiles with no errors, if necessary, click
BillPayer.java in the Selector window to display the code in the TextPad
window. Click Tools on the menu bar and then click Run Java
Application.
The program displays the BillPayer window with its components (Figure 8-18).
Close
button
components
displayed in
rows
Submit
button
FIGURE 8-18
3. Click the Close button in the Command Prompt window.
OTHER WAYS
1. To compile, press
CTRL + 1
2. To compile at
command prompt,
type javac
BillPayer.java
3. To run, press CTRL + 2 ,
enter data
4. To run at command
prompt, type java
BillPayer and then
enter data
Recall how Java's BorderLayout manager stretches components to fill empty
areas. The fieldPanel component fills the North, East, West, and Center areas.
Creating a File Name with a System Date
Crandall Power and Light wants to ensure that no data is lost; therefore, it is
important to keep the data for each day separate for the evening upload to the
central server. If the BillPayer program used the same file name for each data file,
the previous day's data would be overwritten each time the file is constructed.
Appending the system date to the end of the file name creates a unique file, as
shown in Figure 8-19.
 
Search WWH ::




Custom Search