万能百科  > 计算机   > 

[填空题] 下面是生成一个依赖窗口的对话框,属性为modal,请把所缺的代码补齐。 import java.awt.*; public class Dialo

2021-07-20   

[填空题] 下面是生成一个依赖窗口的对话框,属性为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);

词条内容仅供参考,如果您需要解决具体问题
(尤其在法律、医学等领域),建议您咨询相关领域专业人士。

标签