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

📄 logout_view.java

📁 很好的Java绘图程序源代码
💻 JAVA
字号:
package project;

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

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2007</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class Logout_View
    extends JDialog {
  JPanel panel1 = new JPanel();
  JLabel jLabel1 = new JLabel();
  JButton ok_btn = new JButton();
  JButton cancel_btn = new JButton();
  JCheckBox jCheckBox1 = new JCheckBox();
  JFrame owner = null;

  public Logout_View(JFrame owner, String title, boolean modal) {
    super(owner, title, modal);
    this.owner = owner;
    try {
      setDefaultCloseOperation(DISPOSE_ON_CLOSE);
      jbInit();
      this.setSize(400, 220);
      setPositionOnDesktop();
      this.setVisible(true);
      pack();
    }
    catch (Exception exception) {
      exception.printStackTrace();
    }
  }

  private void jbInit() throws Exception {
    panel1.setLayout(null);
    jLabel1.setFont(new java.awt.Font("DialogInput", Font.PLAIN, 14));
    jLabel1.setText("您确定要注销本次登陆?");
    jLabel1.setBounds(new Rectangle(29, 16, 296, 37));
    ok_btn.setBounds(new Rectangle(46, 106, 105, 36));
    ok_btn.setText("确  定");
    ok_btn.addActionListener(new Logout_ok_btn_actionAdapter(this));
    cancel_btn.setBounds(new Rectangle(237, 106, 105, 36));
    cancel_btn.setText("取  消");
    cancel_btn.addActionListener(new Logout_cancel_btn_actionAdapter(this));
    jCheckBox1.setText("注销同时退出系统");
    jCheckBox1.setBounds(new Rectangle(69, 65, 144, 27));
    getContentPane().add(panel1);
    panel1.add(jLabel1);
    panel1.add(ok_btn);
    panel1.add(cancel_btn);
    panel1.add(jCheckBox1);
  }

  private void setPositionOnDesktop() {
    JFrame temp = this.owner;
    this.setLocation( (temp.getSize().width - this.getSize().width) / 2 +
                     temp.getLocation().x,
                     (temp.getSize().height - this.getSize().height) / 2 +
                     temp.getLocation().y);
  }

  public void cancel_btn_actionPerformed(ActionEvent e) {
    this.dispose();
  }

  public void ok_btn_actionPerformed(ActionEvent e) {
    if (jCheckBox1.isSelected()) {
      this.dispose();
      System.exit(0);
    }
    else {
      Frame1 temp = (Frame1)this.owner;
      temp.set_privilege_int( -1);
      temp.remove_panel();
      //temp.repaint();
      this.dispose();
    }
  }
}

class Logout_ok_btn_actionAdapter
    implements ActionListener {
  private Logout_View adaptee;
  Logout_ok_btn_actionAdapter(Logout_View adaptee) {
    this.adaptee = adaptee;
  }

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

class Logout_cancel_btn_actionAdapter
    implements ActionListener {
  private Logout_View adaptee;
  Logout_cancel_btn_actionAdapter(Logout_View adaptee) {
    this.adaptee = adaptee;
  }

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

⌨️ 快捷键说明

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