⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 login.java~1~

📁 Tt s a good book ,if you want to learn java good
💻 JAVA~1~
字号:
package sos;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.event.ActionEvent;
import java.awt.Rectangle;
import java.awt.Font;

public class LogIn extends JDialog {
    public LogIn() {
        super();
        try {
            //setDefaultCloseOperation(DISPOSE_ON_CLOSE);
            jbInit();
        } catch (Exception ex) {
            dispose();
            //  ex.printStackTrace();
        }
    }

    private void jbInit() throws Exception {
        setTitle("登录系统");
        setSize(422, 328);
        this.getContentPane().setLayout(null);
        label_wel.setFont(new java.awt.Font("隶书", Font.BOLD | Font.ITALIC, 40));
        label_wel.setHorizontalAlignment(SwingConstants.CENTER);
        label_wel.setHorizontalTextPosition(SwingConstants.CENTER);
        label_wel.setText("登录系统:");
        label_wel.setBounds(new Rectangle(32, 4, 338, 61));
        label_cat.setFont(new java.awt.Font("黑体", Font.BOLD, 20));
        label_cat.setText("登录身份:");
        label_cat.setBounds(new Rectangle(60, 70, 120, 34));
        label_ID.setFont(new java.awt.Font("黑体", Font.BOLD, 20));
        label_ID.setText("用户姓名:");
        label_ID.setBounds(new Rectangle(60, 120, 120, 34));
        label_pwd.setFont(new java.awt.Font("黑体", Font.BOLD, 20));
        label_pwd.setText("登录密码:");
        label_pwd.setBounds(new Rectangle(60, 170, 120, 34));
        this.getContentPane().setBackground(SystemColor.text);
        button_Reset.setBounds(new Rectangle(232, 232, 121, 37));
        button_Reset.setFont(new java.awt.Font("华文彩云", Font.BOLD | Font.ITALIC,
                                               20));
        button_Reset.setText("重置");
        button_Reset.addActionListener(new LogIn_button_Reset_actionAdapter(this));
        button_Confirm.setBounds(new Rectangle(61, 232, 121, 37));
        button_Confirm.setFont(new java.awt.Font("华文彩云",
                                                 Font.BOLD | Font.ITALIC, 20));
        button_Confirm.setText("登录");
        button_Confirm.addActionListener(new LogIn_button_Confirm_actionAdapter(this));
        tf_ID.setFont(new java.awt.Font("Times New Roman",
                                        Font.BOLD | Font.ITALIC, 20));
        tf_ID.setBounds(new Rectangle(197, 120, 155, 35));
        pf_ID.setFont(new java.awt.Font("Dialog", Font.BOLD, 20));
        pf_ID.setBounds(new Rectangle(197, 170, 155, 35));
        pf_ID.addActionListener(new LogIn_pf_ID_actionAdapter(this));

        jRadioButton1.setBackground(Color.white);
        jRadioButton1.setText("学生");
        jRadioButton1.setBounds(new Rectangle(197, 75, 66, 23));
        jRadioButton1.addActionListener(new LogIn_jRadioButton1_actionAdapter(this));
        jRadioButton2.setBackground(Color.white);
        jRadioButton2.setOpaque(false);
        jRadioButton2.setText("教师");
        jRadioButton2.setBounds(new Rectangle(279, 75, 66, 23));
        jRadioButton2.addActionListener(new LogIn_jRadioButton2_actionAdapter(this));
        this.getContentPane().add(label_pwd);
        this.getContentPane().add(label_ID);
        this.getContentPane().add(label_cat);
        this.getContentPane().add(button_Confirm);
        this.getContentPane().add(button_Reset);
        this.getContentPane().add(tf_ID);
        this.getContentPane().add(pf_ID);
        this.getContentPane().add(jRadioButton1);
        this.getContentPane().add(jRadioButton2);
        this.getContentPane().add(label_wel);
        setVisible(true);
    }

    JLabel label_wel = new JLabel();
    JLabel label_cat = new JLabel();
    JLabel label_ID = new JLabel();
    JLabel label_pwd = new JLabel();
    JButton button_Reset = new JButton();
    JButton button_Confirm = new JButton();
    JTextField tf_ID = new JTextField();
    JPasswordField pf_ID = new JPasswordField();
    JRadioButton jRadioButton1 = new JRadioButton("", false);
    JRadioButton jRadioButton2 = new JRadioButton("", true);
    public void button_Confirm_actionPerformed(ActionEvent e) {

    }

    public void jRadioButton1_actionPerformed(ActionEvent e) {
        jRadioButton2.setSelected(false);
    }

    public void jRadioButton2_actionPerformed(ActionEvent e) {
        jRadioButton1.setSelected(false);
    }

    public void pf_ID_actionPerformed(ActionEvent e) {

    }

    public void button_Reset_actionPerformed(ActionEvent e) {
        tf_ID.setText("");
        pf_ID.setText("");
    }

}


class LogIn_pf_ID_actionAdapter implements ActionListener {
    private LogIn adaptee;
    LogIn_pf_ID_actionAdapter(LogIn adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.pf_ID_actionPerformed(e);
    }
}


class LogIn_jRadioButton2_actionAdapter implements ActionListener {
    private LogIn adaptee;
    LogIn_jRadioButton2_actionAdapter(LogIn adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.jRadioButton2_actionPerformed(e);
    }
}


class LogIn_jRadioButton1_actionAdapter implements ActionListener {
    private LogIn adaptee;
    LogIn_jRadioButton1_actionAdapter(LogIn adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.jRadioButton1_actionPerformed(e);
    }
}


class LogIn_button_Confirm_actionAdapter implements ActionListener {
    private LogIn adaptee;
    LogIn_button_Confirm_actionAdapter(LogIn adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.button_Confirm_actionPerformed(e);
    }
}


class LogIn_button_Reset_actionAdapter implements ActionListener {
    private LogIn adaptee;
    LogIn_button_Reset_actionAdapter(LogIn adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.button_Reset_actionPerformed(e);
    }

    public static void main(String[] args) {
        LogIn a = new LogIn();
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -