
Example 3−4: Dynamically Generated HTML in JEditorPane (continued)
entries[i]) +
"</TD><TD>" + f.length() +
"</TD><TD>" + new Date(f.lastModified()) +
"</TD><TD align=center>" + (f.canRead()?"x":" ") +
"</TD><TD align=center>" + (f.canWrite()?"x":" ") +
"</TD></TR>");
}
out.println("</TABLE>");
out.close();
// Get the string of HTML from the StringWriter and return it.
return sout.toString();
}
}
Pluggable Look-and-Feel
One of the unique features of Swing is its pluggable look-and-feel (PLAF) architec-
tur e, which allows a Swing application to change its entire appearance with one or
two lines of code. The most common use of this feature is to give applications a
choice between the native platform look-and-feel and a new platform-independent
Java look-and-feel (also known as the Metal look-and-feel). Swing is distributed
with three look-and-feels: Metal and two look-and-feels that mimic the appearance
and behavior of the Windows and Motif (Unix/X) component toolkits. A look-and-
feel that mimics the Macintosh platform is available as a separate download. While
the Metal and Motif look-and-feels can be freely used, the Windows look-and-feel
is restricted for use only on Windows platform—for copyright reasons, it does not
run on any other operating system.
When a Swing application starts up, it reads the system property
swing.default-
laf to determine the classname of the default look-and-feel. In most Java ...