Java Reference
In-Depth Information
2. Type import javax.swing.JOptionPane; to replace the text. Press
the ENTER key if necessary, to maintain a blank line 11.
The JOptionPane class from the javax.swing package will be imported
(Figure 3-28).
import statement
to import
JOptionPane class
FIGURE 3-28
OTHER WAYS
Deleting Existing Code
1. To select line, triple-
click line
In the Swing version of the Body Mass Index Calculator, the Swing dialog
boxes will take care of buffering the data from the user and handling IO errors
so that classes and methods from the java.io package, such as the BufferedReader
class in line 20, are no longer necessary. Additionally, the Swing version of the
Body Mass Index Calculator no longer needs blank lines to print in the com-
mand prompt window. While these lines do not affect the output or calculations
of the program, they are unnecessary.
The following steps remove unnecessary code. To select an entire line, you
can double-click the line number or triple-click the line itself.
To Delete Existing Code
1. Drag through the text, throws IOException, in line 14 to select it. Press
the DELETE key.
(continued)
Search WWH ::




Custom Search