0% found this document useful (0 votes)
55 views11 pages

JButton Slides

The document discusses different types of buttons in Java including JButton, JCheckBox, and JRadioButton. JButton is used for command buttons and generates an action event when clicked. JCheckBox and JRadioButton maintain a state and can be on or off. JCheckBox allows selecting individual options while JRadioButton groups are mutually exclusive where only one can be selected. Examples are provided for each button type.

Uploaded by

Anil Tailor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views11 pages

JButton Slides

The document discusses different types of buttons in Java including JButton, JCheckBox, and JRadioButton. JButton is used for command buttons and generates an action event when clicked. JCheckBox and JRadioButton maintain a state and can be on or off. JCheckBox allows selecting individual options while JRadioButton groups are mutually exclusive where only one can be selected. Examples are provided for each button type.

Uploaded by

Anil Tailor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

•Jbutton

•Buttons That Maintain State


•JCheckBox

Prepared by: Anil Kumar Tailor, Assistant Prof.


Engineering College Ajmer
JButton
 A button is a component the user clicks to trigger a
specific action.
 Types of buttons includes, command buttons,
checkboxes, toggle buttons and radio buttons.
 All the button types are subclasses of AbstractButton
(package javax.swing).
 A command button generates an ActionEvent when
the user clicks it.

Prepared by: Anil Kumar Tailor, Assistant Prof.


Engineering College Ajmer
JButton
 Command buttons are created with class JButton.
 The text on the face of a JButton is called a button
label.

Prepared by: Anil Kumar Tailor, Assistant Prof.


Engineering College Ajmer
Jbutton- Example

Prepared by: Anil Kumar Tailor, Assistant Prof.


Engineering College Ajmer
Jbutton- Example

Prepared by: Anil Kumar Tailor, Assistant Prof.


Engineering College Ajmer
Jbutton- Example

Prepared by: Anil Kumar Tailor, Assistant Prof.


Engineering College Ajmer
Buttons That Maintain State
 Three types of state buttons - JToggleButton,
JCheckBox and JRadioButton.
 That have on/off or true/false values.
 Many JRadioButtons are grouped together and are
mutually exclusive - only one in the group can be
selected at any time.

Prepared by: Anil Kumar Tailor, Assistant Prof.


Engineering College Ajmer
JCheckBox- Example

Prepared by: Anil Kumar Tailor, Assistant Prof.


Engineering College Ajmer
JCheckBox- Example

Prepared by: Anil Kumar Tailor, Assistant Prof.


Engineering College Ajmer
JCheckBox- Example

Prepared by: Anil Kumar Tailor, Assistant Prof.


Engineering College Ajmer
Thank You

Prepared by: Anil Kumar Tailor, Assistant Prof.


Engineering College Ajmer

You might also like