JButton Class
Package: javax.swing
The JButton class represents a button: a user interface component that the user can click to initiate an action.
Constructors
|
Constructor |
Description |
|
|
Creates a new button with no initial text |
|
|
Creates a new button with the specified text |
Methods
|
Method |
Description |
|
|
Registers an action event listener for the button. The parameter must be an instance of a class that implements the |
|
|
Triggers an action event for the button as though the user clicked it. |
|
|
Returns the text displayed by the button. |
|
|
Shows or hides the button’s border. The default setting is |
|
|
Specifies whether the button’s background should be filled or left empty. The default setting is |
|
|
Enables or disables the button. The default setting is |
|
|
Enables or disables the rollover effect, which causes the border to get thicker when the mouse moves over the button. The default setting is |
|
|
Sets the text displayed by the button. |
|
|
Sets the tooltip text that’s displayed if ... |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access