Java Reference
In-Depth Information
To Create the StockListDemo Class
1. Create a new TextPad document and save it in the Chapter10 folder, or
a location specified by your instructor, typing StockListDemo as the file
name and selecting Java (*.java) as the file type. Enter lines 1 through 16
as shown in Figure 10-53. In the comments, insert your own name as
programmer and enter the current date.
TextPad displays code for the StockListDemo class in the coding window
(Figure 10-54). The class contains only a main() method, which creates and
activates a LogonFrame object.
StockListDemo.java
StockListDemo
class header
creates new
LogonFrame object
StockListDemo.java
makes LogonFrame
visible
FIGURE 10-54
While the main() method could be included in the LogonFrame class (or in
any class for that matter), it can be in a separate class, as in this case, where the
main() method is included in the StockListDemo class. As long as an object of
the LogonFrame class is created and made visible, where the main() method for
this application resides is not an issue.
The following steps save and compile the StockListDemo Class.
To Save and Compile the StockListDemo Class
1. With your Data Disk in drive A, click the Save button on the Standard
toolbar.
The program changes are saved. Note that the asterisk next to the file
name, StockListDemo.java, is gone, indicating all changes are saved.
2. Click Compile Java on the Tools menu.
TextPad compiles the source code for the Password class. If TextPad notifies
you of compilation errors, fix the errors in the coding window and then
compile the source code again.
OTHER WAYS
1. Press CTRL + 1
 
Search WWH ::




Custom Search