import java.awt.FlowLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JComboBox;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
public class OtakuHigh extends JFrame{
private JLabel label, label1, label2, label3, label4, label5, label6, label7, label8;
private JTextField text1, text2, text4, text5, text7, text8;
private JComboBox Mbox, Dbox, Sbox, Ybox, SCbox;
private JButton Qbutton;
String[] Month = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
String[] Day = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31"};
String[] Sex = {"Male", "Female"};
String[] Year = {"Freshmen", "Sophomore", "Junior", "Senior"};
String[] Sched = {"Morning", "Afternoon", "Evening"};
public OtakuHigh(){
super("Otaku High");
setLayout(new FlowLayout());
label = new JLabel("Otaku High Registration Form");
label.setHorizontalAlignment(JLabel.CENTER);
add(label);
label1 = new JLabel("Name:");
label1.setHorizontalAlignment(JLabel.CENTER);
add(label1);
text1 = new JTextField(10);
text1.setHorizontalAlignment(JTextField.CENTER);
add(text1);
label2 = new JLabel("Age:");
label2.setHorizontalAlignment(JLabel.CENTER);
add(label2);
text2 = new JTextField(10);
text2.setHorizontalAlignment(JTextField.CENTER);
add(text2);
label3 = new JLabel("Sex:");
label3.setHorizontalAlignment(JLabel.CENTER);
add(label3);
JComboBox<String> Sbox = new JComboBox<String>(Sex);
add(Sbox);
label4 = new JLabel("Birthday:");
label4.setHorizontalAlignment(JLabel.CENTER);
add(label4);
JComboBox<String> Mbox = new JComboBox<String>(Month);
add(Mbox);
JComboBox<String> Dbox = new JComboBox<String>(Day);
add(Dbox);
text4 = new JTextField(10);
text4.setHorizontalAlignment(JTextField.CENTER);
add(text4);
label5 = new JLabel("Address:");
label5.setHorizontalAlignment(JLabel.CENTER);
add(label5);
text5 = new JTextField(10);
text5.setHorizontalAlignment(JTextField.CENTER);
add(text5);
label6 = new JLabel("Year:");
label6.setHorizontalAlignment(JLabel.CENTER);
add(label6);
JComboBox<String> Ybox = new JComboBox<String>(Year);
add(Ybox);
label7 = new JLabel("Schedule:");
label7.setHorizontalAlignment(JLabel.CENTER);
add(label7);
JComboBox<String> SCbox = new JComboBox<String>(Sched);
add(SCbox);
label8 = new JLabel("Favorite Anime:");
label8.setHorizontalAlignment(JLabel.CENTER);
add(label8);
text8 = new JTextField(10);
text8.setHorizontalAlignment(JTextField.CENTER);
add(text8);
JButton Qbutton = new JButton("Quit");
Qbutton.setBounds(50, 60, 80, 30);
Qbutton.setHorizontalAlignment(JButton.LEFT);
add(Qbutton);
Qbutton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event){
System.exit(0);
}
});
}
}
this is my Code
the first picture is the output
the second one is the Required Ouput
hanks for your help U.U