资源描述:
《用java编教务系统的源码》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、importjava.awt.*;importjavax.swing.*;importjava.awt.event.*;importjavax.swing.border.*;importjavax.swing.JOptionPane;importjavax.swing.JLabel;importjavax.swing.JPanel;importjavax.swing.table.DefaultTableModel;importjavax.swing.table.TableColumn;importjava.sql.*;importj
2、ava.awt.GridLayout;publicclassmyStudent{publicmyStudent(){}publicstaticvoidmain(String[]args){//TODOcodeapplicationlogichereloginFramelf=newloginFrame();lf.setVisible(true);lf.addWindowListener(newWindowAdapter(){publicvoidwindowClosing(WindowEvente){System.exit(0);}})
3、;}}//主界面classmainFrameextendsJFrameimplementsActionListener{MenuBarmyMenuBar=newMenuBar();MenumyMenuFile,myMenuEdit,myMenuUser,myMenuAbout;MenuItemmiNew,miOpen,miSave,miSaveAs,miExit;MenuItemmiAdd,miEdit,miDel,miFind,miShow,miUser,miAbout;publicJTabletable=newJTable();
4、publicDefaultTableModelmm;publicmainFrame(){myMenuFile=newMenu("文件");miNew=newMenuItem("新建");miOpen=newMenuItem("打开");miSave=newMenuItem("保存");miExit=newMenuItem("退出");//miNew.enable(false);//miOpen.enable(false);//miSave.enable(false);//myMenuFile.add(miNew);//myMenuF
5、ile.add(miOpen);//myMenuFile.add(miSave);myMenuFile.add(miExit);myMenuEdit=newMenu("数据编辑");miFind=newMenuItem("查找数据");miAdd=newMenuItem("添加数据");miEdit=newMenuItem("修改数据");miDel=newMenuItem("删除数据");miShow=newMenuItem("全部显示");myMenuEdit.add(miFind);myMenuEdit.add(miAdd);
6、myMenuEdit.add(miEdit);myMenuEdit.add(miDel);myMenuEdit.add(miShow);myMenuUser=newMenu("用户");miUser=newMenuItem("编辑用户");myMenuUser.add(miUser);myMenuAbout=newMenu("我的作业");miAbout=newMenuItem("作业说明");myMenuAbout.add(miAbout);myMenuBar.add(myMenuFile);myMenuBar.add(myMen
7、uEdit);myMenuBar.add(myMenuUser);myMenuBar.add(myMenuAbout);String[]col={"学号","姓名","性别","民族","年龄","年级","班级","专业"};//创建属性列名mm=newDefaultTableModel(col,0);table.setModel(mm);JScrollPanetableScrollPane=newJScrollPane(table);this.setMenuBar(myMenuBar);this.add(tableScrollP
8、ane);miExit.addActionListener(this);miFind.addActionListener(this);miAdd.addActionListener(this);miEdit.addActionList