欢迎来到天天文库
浏览记录
ID:38723706
大小:61.00 KB
页数:19页
时间:2019-06-18
《学生管理系统(图形界面)——Java》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、学生管理系统(图形界面)——Java源代码:packageexp10;importjavax.swing.JFrame;publicclassMainClass{/***@paramargs*/publicstaticvoidmain(String[]args){//TODOAuto-generatedmethodstubJFramemyFrame=newJFrame("学生成绩管理系统");myFrame.setLocation(300,100);//myFrame.setContentPane(newLoginP
2、ane(myFrame));myFrame.pack();myFrame.setVisible(true);}}packageexp10;importjava.sql.Connection;importjava.sql.DriverManager;importjava.sql.ResultSet;importjava.sql.SQLException;importjava.sql.Statement;publicclassDataBase{Connectionconn=null;publicConnectionget
3、Conn(){returnthis.conn;}publicvoidsetConn(Connectionconn){this.conn=conn;}publicbooleangetConnection(){Stringurl="jdbc:mysql://localhost:3306/ScoreManagement?user=root&password=123";try{Class.forName("org.gjt.mm.mysql.Driver");conn=DriverManager.getConnection(u
4、rl);returntrue;}catch(SQLExceptione){System.out.println(e.getMessage());returnfalse;}catch(ClassNotFoundExceptione){//TODOAuto-generatedcatchblocke.printStackTrace();returnfalse;}}publicResultSetexecuteQuery(Stringsql){ResultSetrs=null;Statementstmt=null;if(con
5、n==null){this.getConnection();}try{stmt=conn.createStatement();rs=stmt.executeQuery(sql);returnrs;}catch(SQLExceptione){returnnull;}}publicintexecuteUpdate(Stringsql){Statementstmt=null;intlinecount=0;if(conn==null){this.getConnection();}try{stmt=conn.createSta
6、tement();linecount=stmt.executeUpdate(sql);}catch(SQLExceptione){}returnlinecount;}}packageexp10;importjava.awt.event.ActionEvent;importjava.awt.event.ActionListener;importjava.sql.ResultSet;importjava.sql.SQLException;importjavax.swing.Box;importjavax.swing.Bu
7、ttonGroup;importjavax.swing.JButton;importjavax.swing.JFrame;importjavax.swing.JLabel;importjavax.swing.JPanel;importjavax.swing.JPasswordField;importjavax.swing.JRadioButton;importjavax.swing.JTextField;publicclassLoginPaneextendsJPanelimplementsActionListener
8、{/****/privatestaticfinallongserialVersionUID=1L;JFramemyFrame;JLabellab_username=newJLabel("用户名");JTextFieldjt_username=newJTextField(20);JLabellab_password=newJLabel("密码")
此文档下载收益归作者所有