Java Reference
In-Depth Information
Q&A
Q Is there a way to change the font of text that appears on a button and other
components?
A The JComponent class includes a setFont( Font ) method that can be used to set the
font for text displayed on that component. You will work with Font objects, color,
and more graphics on Day 13, “Using Color, Fonts, and Graphics.”
Q How can I find out what components are available in Swing and how to use
them?
A This is the first of two days spent introducing user interface components, so you
will learn more about them tomorrow. If you have web access, you can find out
what classes are in the Swing package by visiting Sun's online documentation for
Java at the web address http://java.sun.com/javase/6/docs/api.
Q The last version of Java used the Metal look and feel. How can I continue
using this instead of Ocean?
A You'll learn how to do this in a Java class on Day 10. There's also a system prop-
erty you can specify, swing.metalTheme , that will cause the interpreter to use the
Metal look and feel by default instead of Ocean. This property should have the
value “steel” to switch back to Metal, as in the following command:
java -Dswing.metalTheme=steel Authenticator
Running this command causes the Authenticator application to be displayed in the
Metal look and feel.
Quiz
Review today's material by taking this three-question quiz.
Questions
1. Which of the following user interface components is not a container?
a. JScrollPane
b. JTextArea
c. JWindow
 
 
Search WWH ::




Custom Search