📄 confirmdialog.java
字号:
import java.awt.*;
import java.awt.event.*;
public class ConfirmDialog extends Dialog implements ActionListener
{
private Button okay = new Button ("确定");
private Label lab1 = new Label (" 内存中已没有足够的连续的空间");
private Label lab2 = new Label (" 来存放作业,请释放一些空间以");
private Label lab3 = new Label (" 装入新的作业");
private class WindowCloser extends WindowAdapter {
public void windowClosing (WindowEvent we) {
ConfirmDialog.this.hide();
}
}
public ConfirmDialog (Frame parent) {
super (parent, "Please Confirm", true);
setup ();
okay.addActionListener (this);
addWindowListener (new WindowCloser ());
setSize (100, 200);
//setResizable (false);
pack (); show ();
}
private void setup () {
Panel buttons = new Panel ();
buttons.setLayout (new GridLayout (1, 3));
buttons.add (new Label ());
buttons.add (okay);
buttons.add (new Label ());
Panel cen = new Panel ();
cen.setLayout (new GridLayout (3, 1));
cen.add (lab1);
cen.add (lab2);
cen.add (lab3);
setLayout (new BorderLayout ());
add ("Center", cen);
add ("South", buttons);
}
public void actionPerformed (ActionEvent ae) {
if (ae.getSource() == okay)
hide();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -