?? login.java~141~
字號:
package xscjgl;
import javax.swing.JFrame;
import com.borland.jbcl.layout.XYLayout;
import com.borland.jbcl.layout.*;
import javax.swing.JButton;
import javax.swing.JTextArea;
import javax.swing.JEditorPane;
import javax.swing.JComboBox;
import javax.swing.Box;
import java.awt.Component;
import javax.swing.JTextPane;
import javax.swing.JLabel;
import javax.swing.JPanel;
import java.awt.Color;
import java.awt.Font;
import javax.swing.JTextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JOptionPane;
import java.sql.ResultSet;
import javax.swing.ImageIcon;
import javax.swing.JPasswordField;
import java.awt.Dimension;
import com.borland.dx.sql.dataset.ConnectionDescriptor;
import com.borland.dx.sql.dataset.QueryDescriptor;
import com.borland.dx.sql.dataset.Load;
import java.awt.Rectangle;
/**
* <p>Title: java xscjgl</p>
*
* <p>Description:學(xué)生查成績,管理員輸成績、管理。二種權(quán)限的學(xué)生成績管理系統(tǒng) </p>
*
* <p>Copyright: lixing (c) 2006</p>
*
*
* @author 04級計(jì)算機(jī)教育班 黎興
* @version 1.0
*/
public class login extends JFrame {
public login() {
try {
jbInit();
} catch (Exception ex) {
ex.printStackTrace();
}
}
private void jbInit() throws Exception {
glue1 = Box.createGlue();
this.getContentPane().setLayout(paneLayout1);
this.setForeground(Color.lightGray);
this.setTitle("學(xué)生成績管理系統(tǒng)");
jButton2.setText("退出");
jButton2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
jButton2_actionPerformed(e);
}
});
jPasswordField1.setText("");
jButton1.setText("登陸");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
jButton1_actionPerformed(e);
}
});
jLabel1.setFont(new java.awt.Font("宋體", Font.PLAIN, 15));
jLabel1.setForeground(Color.blue);
jLabel1.setText("學(xué)生成績管理系統(tǒng)登陸");
jPanel1.setBackground(new Color(241, 249, 249));
jPanel1.setLayout(xYLayout2);
jLabel2.setFont(new java.awt.Font("宋體", Font.PLAIN, 14));
jLabel2.setText("用戶名:");
jLabel3.setFont(new java.awt.Font("宋體", Font.PLAIN, 14));
jLabel3.setText("密 碼:");
jPanel1.add(jT_user, new XYConstraints(163, 60, 119, 26));
jPanel1.add(jLabel2, new XYConstraints(47, 53, 79, 44));
jPanel1.add(jLabel3, new XYConstraints(48, 103, 85, 41));
jPanel1.add(jPasswordField1, new XYConstraints(164, 109, 117, -1));
jPanel1.add(jButton2, new XYConstraints(258, 174, -1, -1));
jPanel1.add(jButton1, new XYConstraints(93, 177, -1, -1));
jPanel1.add(jLabel1, new XYConstraints(125, 3, 151, 20));
this.getContentPane().add(jPanel1,
new PaneConstraints("jPanel1", "jPanel1",
PaneConstraints.ROOT, 0.5F));
this.getContentPane().add(glue1,
new PaneConstraints("glue1", "jPanel1",
PaneConstraints.TOP, 0.13907284F));
}
Component glue1 = Box.createGlue();
JPanel jPanel1 = new JPanel();
JLabel jLabel1 = new JLabel();
JLabel jLabel2 = new JLabel();
JTextField jT_user = new JTextField();
JLabel jLabel3 = new JLabel();
JButton jButton2 = new JButton();
JPasswordField jPasswordField1 = new JPasswordField();
JButton jButton1 = new JButton();
DataModule1 dataModule11 = new DataModule1();
PaneLayout paneLayout1 = new PaneLayout();
XYLayout xYLayout2 = new XYLayout();
public void dologin(){
String password_text=jPasswordField1.getText().toString().trim();
String username_text=jT_user.getText().toString().trim();
String strSQL = "select * from UserTable where Uno='" +
username_text + "'";
try{
Jdbcconn conn=new Jdbcconn();
conn.OpenConn("tqti","tqti","111111");
ResultSet rs=conn.getResults(strSQL);
rs.first();
int db_Right=rs.getInt("Uright");
String db_password = rs.getString("Upwd");
if(password_text.equals(db_password)){
this.dispose();
main mianFrame=new main();
mianFrame.setVisible(true);
mianFrame.setLocationRelativeTo(null);
mianFrame.userNumber=username_text;
mianFrame.passWord=password_text;
if(db_Right==3){
mianFrame.jMenuItem2.setVisible(false);
}else if(db_Right==1){
mianFrame.jMenuItem3.setEnabled(false);
}
}else{
JOptionPane.showMessageDialog(null, "用戶名或密碼錯(cuò)誤,請重新輸入!");
jPasswordField1.setText("");
jT_user.setText("");
}
}catch(Exception ex){
JOptionPane.showMessageDialog(null,"catch:用戶名或密碼錯(cuò)誤,請重新輸入!");
jPasswordField1.setText("");
jT_user.setText("");
}//end try catch
}//end dologin
public static void main(String args[]){
login Login_Frame=new login();
Login_Frame.setVisible(true);
Login_Frame.setLocationRelativeTo(null);
Login_Frame.setSize(new Dimension(455,355));
}
public void jButton1_actionPerformed(ActionEvent e) {
this.dologin();
}
public void jButton2_actionPerformed(ActionEvent e) {
System.exit(0);
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -