6 模块分析
6.1 添加模块
学生信息添加部分代码: class charu extends JFrame implements ActionListener { JFrame frame = new JFrame("添加数据");
JPanel imagePanel;
ImageIcon bg;
Button sure;
TextField input1, input2, input3, input4, input5;
TextArea show;
Box box1, box2, box3, box4;
int k, s1, j;
Connection con;
Statement sql;
ResultSet rs;
charu() {
Toolkit kit = Toolkit.getDefaultToolkit();
Image img = kit.getImage("tubiao.jpg");
frame.setIconImage(img);
input1 = new TextField(10);
input2 = new TextField(10);
input3 = new TextField(10);
input4 = new TextField(10);
input5 = new TextField(10);
box2 = Box.createVerticalBox();
box2.add(input1);
box2.add(Box.createVerticalStrut(8));
box2.add(input2);
box2.add(Box.createVerticalStrut(8));
box2.add(input3);
box2.add(Box.createVerticalStrut(8));
box2.add(input4);
box2.add(Box.createVerticalStrut(8));
box2.add(input5);
box1 = Box.createVerticalBox();
box1.add(new Label("学号:"));
box1.add(Box.createVerticalStrut(8));
box1.add(new Label("姓名:"));
box1.add(Box.createVerticalStrut(8));
box1.add(new Label("生日:"));
5