Section 12.9 JButton

• A button is a component the user clicks to trigger an action. All the button types are subclasses of AbstractButton (p. 495; package javax.swing). Button labels (p. 495) typically use book-title capitalization (p. 495).

• Command buttons (p. 495) are created with class JButton.

• A JButton can display an Icon. A JButton can also have a rollover Icon (p. 497)—an Icon that’s displayed when the user positions the mouse over the button.

• Method setRolloverIcon (p. 498) of class AbstractButton specifies the image displayed on a button when the user positions the mouse over it.

Get Java™ How To Program (Early Objects), Tenth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.