📄 exitdialog1.java
字号:
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class ExitDialog1 extends JDialog implements ActionListener{
JLabel jl=new JLabel("是否要保存原来的东西!",JLabel.CENTER);
JButton sure=new JButton("确定");
JButton cancel=new JButton("取消");
boolean exit=false;
public ExitDialog1(MyNotePad nt){
super(nt,"确定保存",true);
Container c=this.getContentPane();
c.setLayout(new FlowLayout());
c.add(jl);
c.add(sure);
c.add(cancel);
sure.addActionListener(this);
cancel.addActionListener(this);
this.setBounds(450,450,200,100);
this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==sure)
{
exit=true;
this.dispose();
}
if(e.getSource()==cancel)
{
exit=false;
this.dispose();
}
}
public boolean getExit()
{
return exit;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -