Sams Teach Yourself Java 2 in 24 Hours

Sams Teach Yourself Java 2 in 24 Hours

By Rogers Cadenhead

Q&A

  1. Is there a way to use different colors in an interface?

    You can use Color objects to change the appearance of each component in several ways. The setBackground() method designates the background elements, and setForeground() sets foreground elements. You must use these methods with the components themselves. The setBackground() method of the applet will not change the color of containers and components within the applet.

  2. Do you need to do anything with the paint() method or repaint() to indicate that a text field has been changed?

    After the setText() method of a text component is used to change its value, nothing else needs to be done. Swing handles the updating necessary to show the new value.

Share ThisShare This

Informit Network