0% found this document useful (0 votes)
15 views2 pages

pr1.1-1

Uploaded by

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

pr1.1-1

Uploaded by

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

Practial 1

import java.awt.*;

public class Pr_1 extends Frame {

public Pr_1() //constructor

setLayout(new FlowLayout());

// Checkboxes

Label checkboxLabel = new Label("Select your hobbies:");

add(checkboxLabel);

Checkbox checkbox1 = new Checkbox("Reading");

add(checkbox1);

Checkbox checkbox2 = new Checkbox("Traveling");

add(checkbox2);

Checkbox checkbox3 = new Checkbox("Gaming");

add(checkbox3);

// Radio Buttons

Label radioButtonLabel = new Label("Select your gender:");

add(radioButtonLabel);

CheckboxGroup radioGroup = new CheckboxGroup();

Checkbox radio1 = new Checkbox("Male", radioGroup, false);

add(radio1);

Checkbox radio2 = new Checkbox("Female", radioGroup, false);


add(radio2);

Checkbox radio3 = new Checkbox("Other", radioGroup, false);

add(radio3);

// Frame settings

setTitle("AWT Checkbox and RadioButton Demo (No Event Handling)");

setSize(400, 400);

setVisible(true);

public static void main(String[] args) {

new Pr_1();

Output:

You might also like