📄 login.java~26~
字号:
package zcgl;
import java.awt.*;
import javax.swing.*;
import java.awt.BorderLayout;
import java.awt.Rectangle;
import java.sql.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class Login extends JFrame {
Connection con=null;
Statement smt=null;
ResultSet rs=null;
public Login() {
try {
jbInit();
} catch (Exception exception) {
exception.printStackTrace();
}
}
private void jbInit() throws Exception {
getContentPane().setLayout(null);
jLabel1.setText("用户名");
jLabel1.setBounds(new Rectangle(57, 90, 82, 40));
jButton1.setBounds(new Rectangle(142, 210, 110, 37));
jButton1.setText("jButton1");
jButton1.addActionListener(new Login_jButton1_actionAdapter(this));
txtPass.setText("jPasswordField1");
txtPass.setBounds(new Rectangle(122, 154, 133, 22));
this.getContentPane().add(jLabel1);
jLabel2.setText("密码");
jLabel2.setBounds(new Rectangle(59, 149, 51, 30));
this.getContentPane().add(txtName);
this.getContentPane().add(jLabel2);
this.getContentPane().add(jButton1);
this.getContentPane().add(txtPass);
txtName.setBounds(new Rectangle(122, 98, 131, 27));
}
JLabel jLabel1 = new JLabel();
JTextField txtName = new JTextField();
JLabel jLabel2 = new JLabel();
JButton jButton1 = new JButton();
JPasswordField txtPass = new JPasswordField();
public void jButton1_actionPerformed(ActionEvent e) {
if(txtName.getText().equals("a") && String.copyValueOf(txtPass.getPassword()).equals("a"))
System.out.println("ggg");
}
}
class Login_jButton1_actionAdapter implements ActionListener {
private Login adaptee;
Login_jButton1_actionAdapter(Login adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton1_actionPerformed(e);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -