Import java.awt.
*;
Import java.awt.event.*;
Public class SimpleAdmissionForm extends Frame implements
ActionListener {
// Components
Label lblName, lblRollNo, lblGender, lblBranch, lblAddress;
TextField txtName, txtRollNo;
Choice genderChoice;
List branchList;
TextArea txtAddress;
Button btnSubmit;
// Constructor to set up the UI
SimpleAdmissionForm() {
setTitle(“Admission Form”);
setSize(300, 400);
setLayout(new FlowLayout());
// Labels and Fields
lblName = new Label(“Name:”);
txtName = new TextField(20);
lblRollNo = new Label(“Roll No:”);
txtRollNo = new TextField(20);
lblGender = new Label(“Gender:”);
genderChoice = new Choice();
genderChoice.add(“Male”);
genderChoice.add(“Female”);
lblBranch = new Label(“Branch:”);
branchList = new List(3);
branchList.add(“CSE”);
branchList.add(“ECE”);
branchList.add(“ME”);
lblAddress = new Label(“Address:”);
txtAddress = new TextArea(3, 20);
btnSubmit = new Button(“Submit”);
btnSubmit.addActionListener(this);
// Adding components to the frame
Add(lblName);
Add(txtName);
Add(lblRollNo);
Add(txtRollNo);
Add(lblGender);
Add(genderChoice);
Add(lblBranch);
Add(branchList);
Add(lblAddress);
Add(txtAddress);
Add(btnSubmit);
// Window closing event
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
dispose();
}
});
setVisible(true);
}
// Event handling
Public void actionPerformed(ActionEvent e) {
If (e.getSource() == btnSubmit) {
System.out.println(“Name: “ + txtName.getText());
System.out.println(“Roll No: “ + txtRollNo.getText());
System.out.println(“Gender: “ +
genderChoice.getSelectedItem());
System.out.println(“Branch: “ +
branchList.getSelectedItem());
System.out.println(“Address: “ + txtAddress.getText());
}
}
// Main method to run the application
Public static void main(String[] args) {
New SimpleAdmissionForm();
}
}