Java Reference
In-Depth Information
The following step enters code for the search() method.
To Code the search() Method
1. Enter the code from Figure 7-34 on the previous page.
TextPad displays the code for the search() method (Figure 7-35). Your lines
may wrap differently.
code to
retrieve and
clear display
code to prompt
user for search data
try
block
methods to
insert array
data
code to
display error
message
catch
block
FIGURE 7-35
J ava 2
v 5 . 0
J ava 2
JAVA UPDATE
v 5 . 0
If no look and feel is
specified in a Java 5.0
program, the compiler
will assign the Ocean
look and feel. New to
J2SE 5.0, the Ocean look
and feel incorporates a
more modern looking
icon within dialog
boxes, a more colorful
Java icon in applet title
bars, and dialog box
buttons that display a
light colored bar or
wave pattern behind
their text.
Look and Feel
Earlier you learned that the look and feel methods give any program using Swing
components a choice of how the windows, title bars, and components
will appear. For example, the same program can use either the Java look and feel
or the Windows look and feel. The LookandFeelDecorated() method displays a
different, more modern window than those generated by Windows or UNIX.
Figure 7-36 displays a LookandFeelDecorated window. Notice that the title bar
now has a pattern to it. The clip controls minimize, maximize, and close —
display with different buttons and without tool tips. You can see that the default
background color is gray rather than white, and the Menu options are displayed
more like buttons than typical menu commands. Java refers to these changes as
window decorations . Developers can design their own window decorations and
save them as a look and feel object.
 
Search WWH ::




Custom Search