📄 loginframe.java
字号:
package card;
import javax.swing.JFrame;
import javax.swing.JLabel;
import java.awt.*;
import javax.swing.JTextField;
import javax.swing.JPasswordField;
import javax.swing.JButton;
import java.awt.Rectangle;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2007</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class LoginFrame extends JFrame {
public LoginFrame() {
try {
jbInit();
} catch (Exception ex) {
ex.printStackTrace();
}
}
private void jbInit() throws Exception {
this.getContentPane().setLayout(null);
setSize(250,200);
this.setTitle("登录");
lblTitle.setFont(new java.awt.Font("Dialog", Font.BOLD, 20));
lblTitle.setText("用户登录");
lblTitle.setBounds(new Rectangle(82, 8, 93, 34));
lblUserName.setFont(new java.awt.Font("Dialog", Font.PLAIN, 15));
lblUserName.setText("用 户 名:");
lblUserName.setBounds(new Rectangle(30, 44, 83, 19));
txtUserName.setText("");
txtUserName.setBounds(new Rectangle(112, 42, 105, 22));
psUserPassword.setBounds(new Rectangle(112, 68, 106, 22));
btnLogin.setBounds(new Rectangle(41, 95, 73, 25));
btnLogin.setFont(new java.awt.Font("Dialog", Font.PLAIN, 15));
btnLogin.setText("登录");
btnLogin.addActionListener(lh);
lh.lf=this;
btnRes.setBounds(new Rectangle(135, 95, 73, 25));
btnRes.setFont(new java.awt.Font("Dialog", Font.PLAIN, 15));
btnRes.setText("取消");
btnRes.addActionListener(lh);
lblErr.setFont(new java.awt.Font("Dialog", Font.PLAIN, 15));
lblErr.setForeground(Color.red);
lblErr.setText("");
lblErr.setBounds(new Rectangle(31, 123, 191, 19));
lblPassword.setFont(new java.awt.Font("Dialog", Font.PLAIN, 15));
lblPassword.setText("密 码:");
lblPassword.setBounds(new Rectangle(30, 70, 83, 19));
this.getContentPane().add(lblTitle);
this.getContentPane().add(lblUserName);
this.getContentPane().add(lblPassword);
this.getContentPane().add(txtUserName);
this.getContentPane().add(psUserPassword);
this.getContentPane().add(btnLogin);
this.getContentPane().add(btnRes);
this.getContentPane().add(lblErr);
}
LoginHandler lh=new LoginHandler();
JLabel lblTitle = new JLabel();
JLabel lblPassword = new JLabel();
JLabel lblUserName = new JLabel();
JTextField txtUserName = new JTextField();
JPasswordField psUserPassword = new JPasswordField();
JButton btnLogin = new JButton();
JButton btnRes = new JButton();
JLabel lblErr = new JLabel();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -