关于对话框的问题 不知道,看不出错在哪了(不过,建议你用swing设计界面,比awt好) 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 import java.awt.*;import java.awt.event.*;public class WWWW extends Frame implements ActionListener{ Button btn=new Button("提示"); Panel p=new Panel(); WWWW() { super("Windows"); setSize(350,200); btn.addActionListener(this);//注册事件。 setVisible(true); add(p); p.add(btn); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); show(); } public static void main(String[] args) { new WWWW(); } public void actionPerformed(ActionEvent e) { if(e.getSource()==btn) { MyDialog dlg=new MyDialog(this,true); dlg.show(); } } class MyDialog extends Dialog { Label label=new Label(); MyDialog(WWWW parent,boolean modal) { super(parent,modal); setSize(260,140); setResizable(false); label.setText("你好"); setLayout(null); label.setBounds(100,60,40,30);//设置LABEL的显示位置。 add(label); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); } }} 大胃不错哦,,他应该是没有在编译器运行的,我有要。btn.addActionListener(this);//注册事件。label.setBounds(100,60,40,30);//设置LABEL的显示位置。 一道I/O流的操作的题,请问被注释的语法可以通过文档查找到用法么? 这样写没有问题是为什么呢? 还是数据库连接的问题,关于ACCESS数据库! swing组件如何刷新? 怎么使用Image这个类 请问各位大侠,那里能够找到JB7的汉化补丁(高分)!!!! 请问哪里有java邮件服务器下载? 那位高手为我解释一下 如何获取java程序在运行过程中哪些类或者哪些方法被调用了,或者是调用的关系等 java中equals与== 帮我解决这个问题 System.runFinalization()与System.gc()的区别是什么
import java.awt.event.*;public class WWWW extends Frame implements ActionListener
{
Button btn=new Button("提示");
Panel p=new Panel();
WWWW()
{
super("Windows");
setSize(350,200);
btn.addActionListener(this);//注册事件。
setVisible(true);
add(p);
p.add(btn);
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
show();
}
public static void main(String[] args)
{
new WWWW();
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==btn)
{
MyDialog dlg=new MyDialog(this,true);
dlg.show();
}
}
class MyDialog extends Dialog
{
Label label=new Label();
MyDialog(WWWW parent,boolean modal)
{
super(parent,modal);
setSize(260,140);
setResizable(false);
label.setText("你好");
setLayout(null);
label.setBounds(100,60,40,30);//设置LABEL的显示位置。
add(label);
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
}
}
}
btn.addActionListener(this);//注册事件。
label.setBounds(100,60,40,30);//设置LABEL的显示位置。