Page 215 - CTS - CSA TP - Volume 2
P. 215
COMPUTER SOFTWARE APPLICATION - CITS
When you run this program, a window will appear with two checkboxes and a submit button. Upon clicking the
submit button, a message dialog will show the selected options based on the checkboxes.
Output:
TASK 2: Create a JCheckBox for Multiple Selection
Code:
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class RadioButtonControlExample {
public static void main(String[] args) {
JFrame frame = new JFrame(“RadioButton Example”);
JRadioButton radioButton1 = new JRadioButton(“Male”);
200
CITS : IT & ITES - Computer Software Application - Exercise 117 CITS : IT & ITES - Computer Software Application - Exercise 117