📄 loginframe1.java~67~
字号:
package logindemo;
import javax.swing.event.*;
import java.awt.*;
import com.borland.jbcl.layout.*;
import javax.swing.*;
import java.awt.event.*;
import java.sql.*;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2007</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
//登入界面
public class LoginFrame1 extends JFrame {
JPanel contentPane;
JPanel jPanel1 = new JPanel();
JPanel jPanel2 = new JPanel();
JPanel jPanel3 = new JPanel();
JButton jButton1 = new JButton(
"<html><center><b><font color=#0000ff>图书管理员</font></html>");//图书管理员身份
JButton jButton2 = new JButton(
"<html><center><b><font color=#0000ff>读者</font></html>");//读者身份
FlowLayout flowLayout1 = new FlowLayout();
FlowLayout flowLayout2 = new FlowLayout();
JLabel jLabel1 = new JLabel("欢迎进入图书查询系统");
public LoginFrame1() {
try {
setDefaultCloseOperation(EXIT_ON_CLOSE);
jbInit();
} catch (Exception exception) {
exception.printStackTrace();
}
}
/**
* Component initialization.
*
* @throws java.lang.Exception
*/
private void jbInit() throws Exception {
contentPane = (JPanel) getContentPane();
contentPane.setLayout(flowLayout2);
setSize(new Dimension(436, 415));
setTitle("欢迎进入图书查询系统");
jPanel1.setLayout(new BoxLayout(jPanel1, BoxLayout.PAGE_AXIS));
jButton1.addActionListener(new LoginFrame1_jButton1_actionAdapter(this));
jButton2.addActionListener(new LoginFrame1_jButton2_actionAdapter(this));
contentPane.add(Box.createRigidArea(new Dimension(100,100)));
jLabel1.setBackground(SystemColor.control);
jLabel1.setFont(new java.awt.Font("楷体_GB2312", Font.PLAIN, 50));
jButton1.setFont(new java.awt.Font("宋体", Font.PLAIN, 20));
jButton2.setFont(new java.awt.Font("宋体", Font.PLAIN, 20));
jPanel2.setBackground(SystemColor.control);
jPanel1.setBackground(SystemColor.controlHighlight);
jPanel2.add(jButton2);
jPanel2.add(jButton1);
jPanel1.add(jLabel1);
jPanel1.add(jPanel2, null);
contentPane.add(jPanel1, null);
}
//管理员身份确认
public void showDialog() {
JDialog dialog = new JDialog(this, "登入框");
JPanel panel1 = new JPanel();
dialog.getContentPane().add(panel1);
JLabel label1 = new JLabel("请输入用户名");
panel1.add(label1);
JTextField text1 = new JTextField(30);
panel1.add(text1);
JLabel label2 = new JLabel("密码");
panel1.add(label2);
JPasswordField userPassword = new JPasswordField(20);
userPassword.setEchoChar('*');
JButton jButton3 = new JButton("登入");
JButton jButton4 = new JButton("重置");
panel1.add(userPassword);
panel1.add(jButton3);
panel1.add(jButton4);
dialog.pack();
dialog.setModal(true);
dialog.setVisible(true);
}
public void jButton1_actionPerformed(ActionEvent e) {
this.setVisible(false);
MainDemoUserframe1 mf = new MainDemoUserframe1();
mf.setVisible(true);
}
public void jButton2_actionPerformed(ActionEvent e) {
this.setVisible(false);
MainDemoframe1 mdf = new MainDemoframe1();
mdf.setVisible(true);
}
}
class LoginFrame1_jButton1_actionAdapter implements ActionListener {
private LoginFrame1 adaptee;
LoginFrame1_jButton1_actionAdapter(LoginFrame1 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton1_actionPerformed(e);
}
}
class LoginFrame1_jButton2_actionAdapter implements ActionListener {
private LoginFrame1 adaptee;
LoginFrame1_jButton2_actionAdapter(LoginFrame1 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton2_actionPerformed(e);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -