欢迎来到天天文库
浏览记录
ID:38254492
大小:199.27 KB
页数:26页
时间:2019-06-07
《java用JDBC连接sqlServer》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、Java用JDBC连接sqlServer数据表:(sqlServer2012)程序运行截图:登录/注册界面主界面/修改密码/修改信息界面源代码:登录界面:sqlsystem.javapackagecom.johnson;importjava.awt.BorderLayout;importjava.awt.EventQueue;importjava.awt.Font;importjava.awt.GridLayout;importjava.awt.event.ActionEvent;importjava.awt.event.Ac
2、tionListener;importjava.sql.Connection;importjava.sql.DriverManager;importjava.sql.ResultSet;importjava.sql.SQLException;importjava.sql.Statement;importjavax.swing.ButtonGroup;importjavax.swing.JButton;importjavax.swing.JFrame;importjavax.swing.JLabel;importjavax.sw
3、ing.JOptionPane;importjavax.swing.JPanel;importjavax.swing.JPasswordField;importjavax.swing.JTextField;importjavax.swing.SwingConstants;importjavax.swing.JRadioButton;importjavax.swing.border.BevelBorder;importjavax.swing.border.CompoundBorder;importjavax.swing.bord
4、er.LineBorder;importjava.awt.Color;publicclasssqlsystem{privateJFrameframe;privateJTextFieldusernameText;privateJPasswordFieldpasswdText;welcomewelFrame;revisePasswdrePasswd;reviseInforeInfo;regregwin;privateJRadioButtonuserRadioButton;privateJRadioButtonsystemRadio
5、Button;/***Launchtheapplication.*/publicstaticvoidmain(String[]args){EventQueue.invokeLater(newRunnable(){publicvoidrun(){try{sqlsystemwindow=newsqlsystem();window.frame.setVisible(true);}catch(Exceptione){e.printStackTrace();}}});}/***Createtheapplication.*/publics
6、qlsystem(){initialize();welFrame=newwelcome();rePasswd=newrevisePasswd();reInfo=newreviseInfo();regwin=newreg();}/***Initializethecontentsoftheframe.*/privatevoidinitialize(){frame=newJFrame();frame.setTitle("u767Bu9646u7CFBu7EDF");//frame.setBounds(100,100,450,
7、300);frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);JPanelpanel=newJPanel();frame.getContentPane().add(panel,BorderLayout.SOUTH);panel.setLayout(newBorderLayout());JPanelpanel2=newJPanel();panel2.setBorder(newCompoundBorder(null,newLineBorder(newColor(0,0,0)))
8、);panel.add(panel2,BorderLayout.CENTER);panel2.setLayout(newGridLayout(3,2));JLabelusernameLabel=newJLabel("用户名:");usernameLabel.setHorizo
此文档下载收益归作者所有