Swing buttons provide features that arc not found in the Button class defined by the
AWT. For example, you can associate an icon with a Swing button. Swing buttons are subclasses of the Abstract Button class, which extends ]Component. AbstractButton contains many methods that allow you to control the behavior of buttons, check b oxes and radio buttons. For example, you can define different icons that are displayed for the component when it is disabled, pressed, or selected, Another icon can be u set as a rollover icon, which is displayed when the mouse is positioned over that component. The following are the methods that control this behavior.

void setDisabledkon(Icon dl).
void setPressedIcon(Icon pI)
void setSelectedlcon{Icon si)
void setkolloverlconflcon rl)
Here, di, pi, si, and ri are the icons to be used for these different conditions.
The text associated with a button can be read and written via the.following methods:
String get Text( )
videocassette{String 5)
Here, s is the text to be associated with the button. .
Concrete sub classes of Abstracted Button generate action events when they are
pressed. Listeners register and unregistered for these events via, the methods shown here:
void odd Action Alston (Action Listener all)
cold remove Action Licencor(Internationalist (II)
H real is the action
Ab treat Button super class for push buttons, ch ck boxes, and ratio buttons.
each is exam next.

reCAPTCHA is required.

Share This