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

📄 dialogtest.java

📁 这是java的源代码,感觉上是挺不错的哦,要下载赶快来哦,有附加数据库的哦
💻 JAVA
字号:
package ptu;

import java.awt.*;
import java.awt.event.*;

public class DialogTest extends Frame{
	Dialog dialog1;
	Button b1,db1,db2;
	public DialogTest()
	{
		this.setTitle("半闭测试");
		this.setSize(200, 200);
		this.setLayout(new  FlowLayout());
		dialog1=new Dialog(this,"关闭确认");
		dialog1.setModal(true);
		dialog1.setLayout(new FlowLayout());
		dialog1.setSize(100, 100);
		b1=new Button("退出");
		db1=new Button("确定");
		db2=new Button("取消");
		b1.addActionListener(new ActionListener(){

			public void actionPerformed(ActionEvent arg0) {
				// TODO 自动生成方法存根
				dialog1.show();
			}
			
		});
		db1.addActionListener(new ActionListener(){

			public void actionPerformed(ActionEvent e) {
				// TODO 自动生成方法存根
				System.exit(0);
			}
			
		});

		db2.addActionListener(new ActionListener(){

			public void actionPerformed(ActionEvent e) {
				// TODO 自动生成方法存根
				dialog1.dispose();
			}			
		});
		this.add(b1);
		dialog1.add(db1);
		dialog1.add(db2);
	}
	public static void main(String[] args)
	{
		DialogTest test1=new DialogTest();
		test1.show();
		test1.addWindowListener(new WindowAdapter(){

			public void windowClosing(WindowEvent arg0) {
				// TODO 自动生成方法存根
				System.exit(0);
			}
		});
	}
}

⌨️ 快捷键说明

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