O'Reilly logo

Graphic Java™ 2, Volume II: Swing, Third Edition by David M. Geary

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 8. Labels and Buttons

Swing labels and buttons—represented by the JLabel and JButton classes, respectively—are simple components that are capable of displaying text or an icon.

Labels by default do not have a border and display a string, an icon, or both. Besides being useful for rather mundane purposes such as adorning text fields, Swing labels also fulfill the role of image canvas (a component that displays an image). Because AWT images are not components, they cannot be added to a container. As a result, many different variations of an ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required