Page 211 - CTS - CSA TP - Volume 2
P. 211
COMPUTER SOFTWARE APPLICATION - CITS
Label dob = new Label(“Date of Birth”);
dob.setBounds(20, 110, 80, 20);
TextField firstNameTF = new TextField();
firstNameTF.setBounds(120, 50, 100, 20);
TextField lastNameTF = new TextField();
lastNameTF.setBounds(120, 80, 100, 20);
TextField dobTF = new TextField();
dobTF.setBounds(120, 110, 100, 20);
// Adding CheckboxGroup for grouping gender checkboxes
CheckboxGroup genderGroup = new CheckboxGroup();
Checkbox maleCheckbox = new Checkbox(“Male”, genderGroup, false);
maleCheckbox.setBounds(20, 140, 80, 20);
Checkbox femaleCheckbox = new Checkbox(“Female”, genderGroup, false);
femaleCheckbox.setBounds(120, 140, 80, 20);
Checkbox otherCheckbox = new Checkbox(“Other”, genderGroup, false);
otherCheckbox.setBounds(220, 140, 80, 20);
// Adding a List with heading “Hobbies”
List hobbiesList = new List();
hobbiesList.add(“Reading”);
hobbiesList.add(“Swimming”);
hobbiesList.add(“Gaming”);
hobbiesList.setBounds(120, 170, 100, 60);
Button sbmt = new Button(“Submit”);
sbmt.setBounds(20, 240, 100, 30);
Button reset = new Button(“Reset”);
reset.setBounds(120, 240, 100, 30);
add(firstName);
add(lastName);
add(dob);
add(firstNameTF);
196
CITS : IT & ITES - Computer Software Application - Exercise 116