[填空题] 下面是生成一个依赖窗口的对话框,属性为modal,请把所缺的代码补齐。 import java.awt.*; public class DialogDemo extends frame {DialogDemo(){ SetTitle("Demo"); Panel p=new Panel(); p.add(new label("one")); p.add(new Checkbox ("two")); add("North",p); add("Center",new textarea("three",3,10)); Dialog d=new Dialog(this," a cat", 【12】 ); d.add("North",new Label ("Modal dialog"); d.add("Center",new textarea("hello"); d.pack (); d.show ();}public static void main(String args[]){ DialogDemo f=new DialogDemo(); f.pack(); f.show();} }
参考答案:
true问题解析:
本题是考查对话框的有关属性和使用方法。Dialog是Window的子类,它表示一个对话窗口。与frame不同,它的存在依赖于其他窗口,当它所依赖的窗口被关闭时,对话框也消失。当指定的对话框为modal,这时当对话框出现时,用户只能对它进行操作,而不能对其他窗口进行操作。Dialog的构造方法如下 Dialog(frame parent,Boolean modal); Dialog(frame parent,Stringtitle,Boolean modal);

![[填空题] 下面是生成一个依赖窗口的对话框,属性为modal,请把所缺的代码补齐。 import java.awt.*; public class DialogDemo extends Frame [填空题] 下面是生成一个依赖窗口的对话框,属性为modal,请把所缺的代码补齐。 import java.awt.*; public class DialogDemo extends Frame](http://www.mshxw.com/aiimages/31/258083.png)
