alertdialog.java

来自「JAVA源代码程序aashjkjhkjhkjhjkhkj」· Java 代码 · 共 58 行

JAVA
58
字号
// AlertDialog class// ================import java.awt.*;import java.awt.event.*;public class AlertDialog extends Dialog implements WindowListener,	ActionListener{	protected Button button;	protected Label label;	public AlertDialog(Frame parent, String message)	{		super(parent,"ALERT",false);		this.setLayout(new BorderLayout(15,15));		label = new Label(message);		this.add("Center",label);		button = new Button("Okay");		Panel p = new Panel();		p.setLayout(new FlowLayout(FlowLayout.CENTER,15,15));		p.add(button);		button.addActionListener(this);		this.add("South",p);		this.pack();		this.show();	}	public void actionPerformed (ActionEvent event)	{		if (event.getSource() == button)		{			this.setVisible(false);			this.dispose();		}	} // end of method "actionPerformed"	public void windowOpened(WindowEvent event) {}        public void windowIconified(WindowEvent event) {}        public void windowDeiconified(WindowEvent event) {}        public void windowClosed(WindowEvent event) {}        public void windowActivated(WindowEvent event) {}        public void windowDeactivated(WindowEvent event) {}	public void windowClosing(WindowEvent event)	{	dispose();	} // end of method "windowClosing"} // end class "AlertDialog"

⌨️ 快捷键说明

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