- 论坛徽章:
- 0
|
编程中出现的错误:
1. false拼写错误
2.Dialog 拼写错误
3.注意本题中(1)建立一个Frame(checkbox)
(2)建立一个Dialog(f,“心理测试”,true)
(3)Panel(确定。取消)
import java.awt.*;
public class A
{
public static void main(String args[])
{
Frame f=new Frame("checkbox");
Dialog dlg=new Dialog(f,"心理测试",false);
dlg.add(new Label("现在想我了吗?"),"Center");
Panel p=new Panel();
p.setLayout(new GridLayout(1,2));
p.add(new Button("确定"));
p.add(new Button("取消"));
dlg.add(p,"South");
f.setBounds(100,100,200,100);
dlg.setBounds(150,200,200,100);
f.pack();
dlg.setVisible(true);
f.setVisible(true);
System.out.println("hi");
}
}
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/86964/showart_1679980.html |
|