errordialog.java

来自「基于UML的运动会成绩统计系统设计。1.1运动会成绩统计系统包括个人成绩统计」· Java 代码 · 共 51 行

JAVA
51
字号
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package sports;import java.awt.*;import java.awt.event.*;/** * *该类是弹出的对话框  */class ErrorDialog extends Dialog implements ActionListener{    private Button okay = new Button("确定");	//private Button cancel = new Button("取消");	private Label label = new Label(" ", Label.CENTER);	public boolean isOkay = false;    @SuppressWarnings("empty-statement")	public ErrorDialog(Frame parent, String title, String prompt) {		super(parent, title, true);		addWindowListener(new WindowAdapter() {			public void windowClosing(WindowEvent Di) {				ErrorDialog.this.isOkay = false;				ErrorDialog.this.setVisible(false);			}		});		okay.addActionListener(this);		Panel buttons = new Panel();		buttons.setLayout(new FlowLayout());		buttons.add(okay);		//buttons.add(cancel);                label.setText(prompt);		setLayout(new BorderLayout());		add("Center", label);		add("South", buttons);		pack();                this.setSize(400, 150);		this.setLocation(360, 290);;		this.setVisible(true);	}	public void actionPerformed(ActionEvent ae) {		isOkay = (ae.getSource() == okay);		setVisible(false);	}}

⌨️ 快捷键说明

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