08吉小凯 - 学生选课系统 下载本文

b2=new Button(\重置\l1=new Label(\所选课程\

box1=new Checkbox(\离散数学\box2=new Checkbox(\汇编语言\box3=new Checkbox(\语言设计\box4=new Checkbox(\软件工程\box5=new Checkbox(\操作系统\box6=new Checkbox(\马克思政治学\box1.addItemListener(this); box2.addItemListener(this); box3.addItemListener(this); box4.addItemListener(this); box5.addItemListener(this); box6.addItemListener(this); add(l2); add(t1); add(l3); add(t2); add(b1); add(b2); add(l1); add(box1);

add(box2); add(box3); add(box4); add(box5); add(box6); add(t);

b1.addActionListener(this); b2.addActionListener(this); setSize(500,500); setVisible(true);

addWindowListener(new WindowAdapter() { } ); validate();}

public void windowClosing(WindowEvent e) {System.exit(0);}

public void itemStateChanged(ItemEvent e)

{ }

public void actionPerformed(ActionEvent a) {

if(a.getSource()==b1) {

Connection con; Statement sql; ResultSet rs;

String number1,name1,lesson1, recode,insertStr; try{ }

catch(ClassNotFoundException g){

Class.forName(\

Checkbox box=(Checkbox)e.getSource(); if(box.getState()) {

int n=t.getCaretPosition(); t.insert(box.getLabel(),n);}

else

{t.setText(\

}

System.out.println(\

try{

con=DriverManager.getConnection(\

sql=con.createStatement(); number1=t1.getText(); name1=t2.getText(); lesson1=t.getText();

recode=\

+\

insertStr=\

values\

sql.executeUpdate(insertStr);

con.close(); dispose();

RuanJian rj=new RuanJian(\查询窗口\ }

catch(SQLException h)

{System.out.println(h);} }