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

📄 10.20dialogtest.java

📁 JAVA程序设计的源代码
💻 JAVA
字号:
import java.awt.*;
import java.awt.event.*;
public class DialogTest extends Frame implements ActionListener{
Frame f;
Dialog d;
Button b;
Label l;
public void go(){
f = new Frame ("对话框");
d = new Dialog (f, "ok", false);    //创建一个对话框
b = new Button ("ok");
l = new Label ("Welcome to come!");
f.setBounds(200,200,200,200);    //设置版面显示区域
f.add ("Center",b);    
d.add ("Center",l);
d.setBounds(300,300,150,100);    //设置对话框显示区域
b.addActionListener (this);    //设置事件监听
f.setVisible (true);    //设置面板可见
}
public void actionPerformed (ActionEvent e){    //事件处理函数
//按下f上的按钮时
d. setVisible (true);    //设置对话框可见
}
public static void main (String args[]){
DialogTest e=new DialogTest();
e.go();
}
}

⌨️ 快捷键说明

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