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

📄 relog.java~19~

📁 Tt s a good book ,if you want to learn java good
💻 JAVA~19~
字号:
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 Relog extends JDialog {

    public Relog(Frame frame, boolean modal, String lookNFeelClassName) {
        super(frame, modal);
        try {
            jbInit();
        } catch (Exception ex) {
            dispose();
        }

        try {
            UIManager.setLookAndFeel(lookNFeelClassName);
            SwingUtilities.updateComponentTreeUI(this);
        } catch (Exception e) {
            System.out.println("Warning! Look and feel problem!");
        }

        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        Dimension frameSize = getSize();
        if (frameSize.height > screenSize.height) {
            frameSize.height = screenSize.height;
        }
        if (frameSize.width > screenSize.width) {
            frameSize.width = screenSize.width;
        }
        setLocation((screenSize.width - frameSize.width) / 2,
                    (screenSize.height - frameSize.height) / 2);

        setVisible(true);

    }

    private void jbInit() throws Exception {
        this.getContentPane().setBackground(SystemColor.controlLtHighlight);
        setTitle("重新登录?");
        setSize(420, 312);
        this.getContentPane().setLayout(null);
        jLabel_Prompt1.setFont(new java.awt.Font("华文新魏", Font.BOLD, 25));
        jLabel_Prompt1.setForeground(Color.red);
        jLabel_Prompt1.setHorizontalAlignment(SwingConstants.CENTER);
        jLabel_Prompt1.setText("你已经登录!是否重新登录?");
        jLabel_Prompt1.setBounds(new Rectangle(21, 44, 371, 65));
        jLabel_Pormpt2.setFont(new java.awt.Font("华文行楷", Font.PLAIN, 20));
        jLabel_Pormpt2.setHorizontalAlignment(SwingConstants.CENTER);
        jLabel_Pormpt2.setText("注销并重新登录请单击“确定”;");
        jLabel_Pormpt2.setBounds(new Rectangle(21, 94, 367, 54));
        jLabel_Prompt3.setFont(new java.awt.Font("华文行楷", Font.PLAIN, 20));
        jLabel_Prompt3.setHorizontalAlignment(SwingConstants.CENTER);
        jLabel_Prompt3.setText("退出请单击“取消”。");
        jLabel_Prompt3.setBounds(new Rectangle(21, 123, 367, 58));
        jButton_Confirm.addActionListener(new
                                          Relog_jButton_Confirm_actionAdapter(this));
        jButton_Confirm.setFont(new java.awt.Font("方正舒体", Font.PLAIN, 20));
        jButton_Cancel.setFont(new java.awt.Font("方正舒体", Font.PLAIN, 20));
        jButton_Cancel.addActionListener(new Relog_jButton_Cancel_actionAdapter(this));
        this.getContentPane().add(jLabel_Pormpt2);
        jButton_Cancel.setBounds(new Rectangle(239, 191, 128, 38));
        jButton_Cancel.setText("取消");
        jButton_Confirm.setBounds(new Rectangle(54, 191, 128, 38));
        jButton_Confirm.setText("确定");
        this.getContentPane().add(jLabel_Prompt3);
        this.getContentPane().add(jLabel_Prompt1);
        this.getContentPane().add(jButton_Cancel);
        this.getContentPane().add(jButton_Confirm);

    }

    JLabel jLabel_Prompt1 = new JLabel();
    JLabel jLabel_Pormpt2 = new JLabel();
    JLabel jLabel_Prompt3 = new JLabel();
    JButton jButton_Confirm = new JButton();
    JButton jButton_Cancel = new JButton();
    public void jButton_Confirm_actionPerformed(ActionEvent e) {
        TestFrame.hasLogIn = false;
        dispose();
        TestFrame.log = new LogInTest(TestFrame.aCheck,
                                      true,
                                      "com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
        TestFrame.reset();
    }

    public void jButton_Cancel_actionPerformed(ActionEvent e) {
        dispose();
    }
}


class Relog_jButton_Cancel_actionAdapter implements ActionListener {
    private Relog adaptee;
    Relog_jButton_Cancel_actionAdapter(Relog adaptee) {
        this.adaptee = adaptee;
    }

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


class Relog_jButton_Confirm_actionAdapter implements ActionListener {
    private Relog adaptee;
    Relog_jButton_Confirm_actionAdapter(Relog adaptee) {
        this.adaptee = adaptee;
    }

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

⌨️ 快捷键说明

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