Java Reference
In-Depth Information
5. Double-click Welcome. If necessary, click View on the menu bar and
then click Line Numbers to display line numbers in the coding window.
The Java source code for the Welcome to My Day application is displayed in
the coding window (Figure 2-47).
TextPad window
source code
coding
window
FIGURE 2-47
Entering Code to Import Applet Packages
The first step in converting the Welcome to My Day application into an
applet is to import two new class packages that Java will need to support the
applet-related methods. The first package is the applet package , which allows
applets to inherit certain attributes and manipulate classes. The second package
is the Abstract Window Toolkit ( AWT ), which is a package included with the
SDK to provide programs access to color, draw methods, and other GUI ele-
ments commonly used in applets.
As shown in lines 11 and 12 in Figure 2-48, two import statements are used
to import the applet and AWT packages. Because Java will need to use multiple
classes from the two packages, you will insert a period and then an asterisk (*)
at the end of the import statement. The asterisk is a wildcard symbol to tell
the program to import all necessary classes from the java.awt and java.applet
packages.
 
Search WWH ::




Custom Search