Java: Buttons
There are many kinds of buttons, all derived from the AbstractButton class.
Components | Description |
---|---|
JButton | This is a standard button which can have text, icon, or both.
Listener: addActionListener(...) |
JCheckBox | The box next to the text can be toggled on or off. |
JRadioButton, ButtonGroup | Radio buttons are a group of buttons that can have at most one button toggled on. When you click one button, that button is toggled on, and all others are set to off. |
JMenuItem | Menu items are a kind of button. |
JToggleButton | Changes between two states: on and off. Stays on/off until the next click. |