Java Reference
In-Depth Information
3 Understanding Error Messages
Using TextPad, open the file named Connections from the Chapter07 folder
of the Data Disk that accompanies this topic. Use the Replace command on the
Search menu to replace all occurrences of the word, Connections, with the word,
Modems. Save the file as a Java source code file with the file name Modems.
Then, compile the program. When TextPad displays errors in the Command
Results window, double-click the first line of the first error message to return to
that line in the TextPad coding window. Fix the error. If directed by your instruc-
tor, insert a comment line in your code identifying what caused the error.
Compile again and repeat the process until the program is error free. Submit
your source code to your instructor electronically or on paper as directed.
J ava 2
J ava 2
v 5 . 0
v 5 . 0
4 Using the Java API and Java Tutorials
The Java API is a good tool to look up information about a class with which you
may be unfamiliar or to check the syntax of commands and methods you wish
to use in your programs. While connected to the Internet, start a browser, type
http://java.sun.com/j2se/1.5.0/docs/api/ in the Address text box, and
then press the ENTER key to view the Java API Specification on the Sun Web site.
(Or, if you downloaded the documentation from the CD-ROM that accompa-
nies this topic, navigate to the installed version of the Java SDK on your system.
Open the index.html file in the docs/api folder.)
With the Java API Specification open in a browser window, perform the
following steps.
1. Click the NO FRAMES link and then click the Index link at the top of the
page. When the Index is displayed, click the J link. Scroll downward and then
click the JTextPane link to display the Web page shown in Figure 7-51.
2. Review the hierarchy of the JTextPane and then scroll down and read the
description of the JTextPane.
3. If your system is connected to the Web, click the Using Text Components
link to the tutorial.
4. When the tutorial is displayed, read the information. Scroll down and click
the link, example index.
5. Download the example, TextSamplerDemo.java, and open it in TextPad.
Insert comments for the lines that contain Swing component references.
Print a copy for your instructor.
6. Return to the API and use the Index to research the class definition for each
Text component. Click the class or method definitions and report on what
you have read, as directed by your instructor.
Search WWH ::




Custom Search