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

📄 escdialog.java

📁 好的超市源码供大家下载
💻 JAVA
字号:
package view.dialog.posdialog;

import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;

import view.com.CenterDialog;
import view.com.consts.FontConst;
import view.frame.PosFrame;

/**
 * 退出对话框
 * @author linfeng
 *
 */
public class EscDialog extends JDialog {
  
  /**
   * escDialog 退出对话框
   * ok 确定按钮
   * cancel 取消按钮
   * message 提示标签
   * fl 流式布局
   */
  private JDialog escDialog;
  private JButton ok, cancel;
  private JLabel message;
  private FlowLayout fl;

  public EscDialog() {
    escDialog = new JDialog();
    escDialog.setTitle("退出");
    escDialog.setSize(180, 100);
    escDialog = new CenterDialog().getCenterDialog(escDialog, true);
    initial();
    escDialog.setLayout(fl);
    escDialog.add(message);
    escDialog.add(ok);
    escDialog.add(cancel);
    escDialog.setVisible(true);
  }

  /**
   * 初始化各种组件
   */
  public void initial() {
    ok = new JButton("确定");
    ok.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        escDialog.dispose();
        PosFrame.frame.dispose();
      }
    });
    cancel = new JButton("取消");
    cancel.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        escDialog.dispose();
      }
    });
    message = new JLabel("    确定要退出吗?   ");
    message.setFont(FontConst.KAITI_BOLD_15);
    fl = new FlowLayout();
  }
}

⌨️ 快捷键说明

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