问题描述
ackagecom.apew;importjava.awt.BorderLayout;importjava.awt.Checkbox;importjava.awt.CheckboxGroup;importjava.awt.Container;importjava.awt.Font;importjava.awt.event.ActionEvent;importjava.awt.event.ActionListener;importjava.awt.event.ItemEvent;importjava.awt.event.ItemListener;importjava.sql.PreparedStatement;importjava.sql.ResultSet;importjava.util.ArrayList;importjavax.swing.JButton;importjavax.swing.JFrame;importjavax.swing.JLabel;importjavax.swing.JPanel;importjavax.swing.JTextField;publicclass学生信息图形界面extendsJFrameimplementsActionListener{/****/privatestaticfinallongserialVersionUID=1L;public学生信息图形界面(){//构造方法super("学生信息图形界面");setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);setSize(320,300);setVisible(true);Containercontent=getContentPane();JPaneljp1=newJPanel();//创建一个面板JLabellabel=newJLabel("学生姓名:");//欢迎界面的欢迎语句label.setFont(newFont("楷体_GB2312",Font.BOLD,20));//设置显示的字体jp1.add(label);//将标签添加到面板jp1中JPaneljp2=newJPanel();JLabellabel1=newJLabel("欢迎使用学生信息管理系统");//输入提示输入的语言:label1.setFont(newFont("楷体_GB2312",Font.BOLD,18));//设置显示的字体JLabellabel2=newJLabel("合肥学院欢迎您");//提示各种输入内容的标签label2.setFont(newFont("楷体_GB2312",Font.BOLD,28));JTextFieldfield1=newJTextField(10);JLabellabel4=newJLabel("学生性别:");label4.setFont(newFont("楷体_GB2312",Font.BOLD,18));CheckboxGroupgroup1=newCheckboxGroup();Checkboxcheck11=newCheckbox("男",true,group1);check11.setFont(newFont("楷体_GB2312",Font.BOLD,18));check11.addItemListener(newCheckHandler1(1));Checkboxcheck12=newCheckbox("女",false,group1);check12.setFont(newFont("楷体_GB2312",Font.BOLD,18));check12.addItemListener(newCheckHandler1(2));JLabellabel5=newJLabel("出生日期:");label5.setFont(newFont("楷体_GB2312",Font.BOLD,18));JTextFieldfield3=newJTextField("",3);JLabellabel51=newJLabel("年");label51.setFont(newFont("楷体_GB2312",Font.BOLD,18));JTextFieldfield4=newJTextField("",2);JLabellabel52=newJLabel("月");label52.setFont(newFont("楷体_GB2312",Font.BOLD,18));JTextFieldfield5=newJTextField("",2);JLabellabel53=newJLabel("日");label53.setFont(newFont("楷体_GB2312",Font.BOLD,18));JLabellabel6=newJLabel("联合培养:");label6.setFont(newFont("楷体_GB2312",Font.BOLD,18));CheckboxGroupgroup2=newCheckboxGroup();Checkboxcheck21=newCheckbox("是",true,group2);check21.setFont(newFont("楷体_GB2312",Font.BOLD,18));check21.addItemListener(newCheckHandler2(1));Checkboxcheck22=newCheckbox("否",false,group2);check22.setFont(newFont("楷体_GB2312",Font.BOLD,18));check22.addItemListener(newCheckHandler2(2));jp2.add(label1);jp2.add(label2);jp2.add(field1);jp2.add(label);jp2.add(field1);jp2.add(label4);jp2.add(check11);jp2.add(check12);jp2.add(label5);jp2.add(field3);jp2.add(label51);jp2.add(field4);jp2.add(label52);jp2.add(field5);jp2.add(label53);jp2.add(label6);jp2.add(check21);jp2.add(check22);content.add(jp1,BorderLayout.NORTH);content.add(jp2,BorderLayout.CENTER);}publicvoidactionPerformed(ActionEvente){}classCheckHandler1implementsItemListener{privateintsel;CheckHandler1(intselect){sel=select;}publicvoiditemStateChanged(ItemEvente){switch(sel){case1:method1();break;case2:method2();break;}}privatevoidmethod1(){}privatevoidmethod2(){}}classCheckHandler2implementsItemListener{privateintsel;CheckHandler2(intselect){sel=select;}publicvoiditemStateChanged(ItemEvente){switch(sel){case1:method1();break;case2:method2();break;}}privatevoidmethod1(){}privatevoidmethod2(){}}publicstaticvoidmain(String[]args){学生信息图形界面界面=new学生信息图形界面();界面.setVisible(true);}}