niusouti.com

Given the following expression about TextField which use a proportional pitch font.  TextField t = new TextField("they are good",40);     Which statement is true?() A、 The displayed string can use multiple fonts.B、 The maximum number of characters in a l

题目

Given the following expression about TextField which use a proportional pitch font.  TextField t = new TextField("they are good",40);     Which statement is true?() 

  • A、 The displayed string can use multiple fonts.
  • B、 The maximum number of characters in a line will be 40.
  • C、 The displayed width is exactly 40 characters.
  • D、 The user can edit the characters.

相似考题
参考答案和解析
正确答案:D
更多“Given the following expression about TextField which use a proportional pitch font.  TextField t = new TextField("they are good",40);     Which statement is true?() A、 The displayed string can use multiple fonts.B、 The maximum number of characters in a li”相关问题
  • 第1题:

    创建一个标识有“关闭”按钮的语句是( )。

    A.TextField b=new TextField("关闭");

    B.Button b=new Burron("关闭");

    C.Checkbox b=new Checkbox("关闭");

    D.Label b=new Label("关闭");


    正确答案:B
    解析:本题考查对AWT基本组件的了解。选项A错误,创建的是一个初始显示为“关闭”的文本框:选项B正确,创建的是一个标识有“关闭”的按钮;选项C错误,Checkbox为复选框类,只能设定是否含标签;选项D错误,创建的是一个标记为“关闭”的标签。故本题答案是B。

  • 第2题:

    下面Applet在窗口中实现一个不可编辑的TextField,并且显示“ok”。在横线处填入正确的语句。

    import java.applet.Applet;

    import java.awt.t;

    public class Test extends Applet {

    TextField tf;

    public void init () {

    setLayout (new GridLayout(1,0);

    tf=new TextField("ok");

    【 】

    add(tf);

    }

    }


    正确答案:setEditable(false)
    setEditable(false) 解析:通过调用TextField构件的setEditable(booleanb)方法,可以设置文本区的可编辑属性,参数b为false时,文本为不可编辑。

  • 第3题:

    在程序中,使用适当的布局管理器,在Frame框的North位置添加一句提示信息,在South位置添加一个单行文本框,在这个文本框中输入的内容将会显示在Center位置。运行结果如下图所示。

    注意:请勿修改main()主方法和其他已有语句内容,仅在横线处填入适当语句。

    import java.awt.*;

    import java.awt.event.*;

    public class simple extends Frame

    {

    public static void main(String[] args)

    {

    simple frame=new simple("simple");

    frame.init();

    frame.setSize(300,300);

    frame.show();

    }

    public simple(String name)

    {

    super(name);

    addWindowListener(new WindowAdapter()

    { public void windowClosing(WindowEvent e)

    {______;

    }

    } );

    }

    public void init()

    {

    setLayout(new______);

    Label labelTitle=new Label("在本文框中输入字符串, 可以早Frame中间显示");

    Label showTextLabel=new Label();

    TextField textField=new TextField("请在这里输入字符串");

    textField.addActionListener(new AddStringListener(showTextLabel,

    textField));

    add("North", labelTitle);

    add("Center", showTextLabel);

    add("South", textField);

    }

    }

    class AddStringListener implements ActionListener

    {

    Label label;

    TextField textField;

    public AddStringListener(Label label, TextField textField)

    {

    this.label=label;

    this.textField=textField;

    }

    public void actionperformed(ActionEvent e)

    {

    label.setText(textField.getText());

    }

    }


    正确答案:System.exit(0) BorderLayout()
    System.exit(0) BorderLayout() 解析:本题考查知识点:AWT库的使用,布局管理器的使用。解题思路:程序使用label Title来显示提示信息,使用text Field来获取用户的输入,最后将用户输入的结果通过showTextLabel显示出来。Frame的关闭按钮的处理方式与JFrame的方式不同,Frame必须手动实现退出按钮的事件处理机制,否则单击关闭按钮程序不会做出响应。本题的第1空就是对退出按钮事件响应的内容。BorderLayout布局管理器将容器分为五个区域:North、South、East、West和 Center。可以指定构件放在哪个区域,但是每个区域只能放置一个构件。第2个空即是为Frame设置BorderLayout类型的布局管理器。

  • 第4题:

    给出下列关于使用适当的字符间距的字体的TextField的表达式,则哪个选项的叙述是正确的? ( ) TextField t=new TextField("they are good",40);

    A.被显示的字符串可以使用多种字体

    B.一行中最大的字符数是40

    C.显示的宽度正好是40个字符宽

    D.用户可以编辑字符


    正确答案:D

  • 第5题:

    Which of the following are true about SSIDs configured in the ADU?()

    • A、SSIDs are not case sensitive.
    • B、SSIDs must be listed in the same order in the ADU as they are in the access point.
    • C、A maximum of three SSIDs may be configured.
    • D、SSIDs may have a maximum of 16 characters.

    正确答案:C

  • 第6题:

    AWT中创建一个标识有“确定”按钮的语句是()

    • A、TextField b = new TextField(“确定”);
    • B、Checkbox b = new Checkbox(“确定”);
    • C、Buttn b = new Button(“确定”);
    • D、Label b = new Label(“确定”);

    正确答案:C

  • 第7题:

    创建一个标识有“关闭”按钮的语句是()。

    • A、TextField b = new TextField(“关闭”);
    • B、Label b = new Label(“关闭”);
    • C、Checkbox b = new Checkbox(“关闭”);
    • D、Button b = new Button(“关闭”);

    正确答案:D

  • 第8题:

    Which of the following statements are true when creating NETBIOS names? ()

    • A、 NETBIOS names can only use alphanumeric characters.
    • B、 You can use a ’.’ in a NETBIOS name.
    • C、 You can use an ’_’ (underscore) in a NETBIOS name.
    • D、 NETBIOS names must be UPPERCASE
    • E、 NETBIOS names can be a maximum of 32 characters

    正确答案:B,C

  • 第9题:

    Which three statements about subqueries are true?()

    • A、A single row subquery can retrieve only one column and one row.
    • B、A single row subquery can retrieve only one row but many columns.
    • C、A multiple row subquery can retrieve multiple rows and multiple columns.
    • D、A multiple row subquery can be compared by using the ">" operator.
    • E、A single row subquery can use the IN operator.
    • F、A multiple row subquery can use the "=" operator.

    正确答案:B,C,D

  • 第10题:

    单选题
    给出以下关于一个使用适当的字符间距的字体的TextField的表达式TextField t = new TextField("they are good",40);以下说法中()是正确的
    A

    被显示的字符串可以使用多种字体//只有一种字体

    B

    一行中最大的字符数是40//使显示的最大字符数

    C

    显示的宽度正好是40个字符宽//有可能不足 只是设置的最佳大小

    D

    用户可以编辑字符


    正确答案: C
    解析: 暂无解析

  • 第11题:

    单选题
    Given the following expression about TextField which use a proportional pitch font.  TextField t = new TextField("they are good",40);     Which statement is true?()
    A

     The displayed string can use multiple fonts.

    B

     The maximum number of characters in a line will be 40.

    C

     The displayed width is exactly 40 characters.

    D

     The user can edit the characters.


    正确答案: B
    解析: 对于TextField的该种形式的构造函数来说,前一个参数是文本域中初始的字符串的显示值,而后一个是推荐的显示宽度,以列数表示,在构造文本域的时候会将这个大小设置为最佳大小,如果容器的限制使得文本域不能显示这么多也没有办法,一般来说是比这个大小大的,而且即使宽度很小,你也可以在文本域的一行中输入很长的字符串,只有你不使用回车,在超过显示宽度后文本域会自动出现水平滚动条(没有被设置为关闭,缺省是不关闭的),而文本域的缺省编辑方式是可编辑的,一个文本域只能使用一种字体,这个字体可以在运行的过程中动态的改变,但是文本域中的所有字符串都将使用这个字体显示。

  • 第12题:

    单选题
    import java.awt.*;   public class Test extends Frame {   public Test() {   add(new Label(“Hello”) );   add(new TextField(“Hello”) );   add(new Button(“Hello”) );   pack();   show();    }   public static void main(String args) {   new Test ();   }   }   What is the result? ()
    A

     The code will not compile.

    B

     A Window will appear containing only a Button.

    C

     An IllegalArgumentException is thrown at line 6.

    D

     A Window button will appear but will not contain the Label, TextField, or Button.

    E

     A Window will appear containing a Label at the top, a TextField below the Label, and a Button  below the TextField.

    F

     A Window will appear containing a Label on the left, a TextField to the right of the Label, and a button to the right of the TextField.


    正确答案: B
    解析: 暂无解析

  • 第13题:

    下列选项中可以创建一个标识有“关闭”的按钮语句的是( )。

    A.TextField b = new TextField("关闭");

    B.TextArea b=new TextArea("关闭");

    C.Button b = new Button("关闭");

    D.Checkbox b = new Checkbox("关闭");


    正确答案:C
    解析:TextField为单行文本输入区,TextArea为多行多列文本输入区,Button为按钮, Checkbox为复选框。

  • 第14题:

    下列______是创建一个标识有“关闭”按钮的语句。 ( )

    A.TextField b=new TextField("关闭");

    B.TexArea b=new TexArea("关闭");

    C.Button b=new Button("关闭");

    D.Checkbox b=new Checkbox("关闭");


    正确答案:C
    解析:创建一个按钮应该用But-ton,所以选项C是正确的;选项A中的Text-Field是创建单行文本框时用到的组件;选项B中的TexArea是创建多行文本框时用到的组件;选项D创建的是复选框。

  • 第15题:

    以下程序中,使用适当的布局管理器,在Frame框的“North”位置添加一句提示信息,在“South”位置添加一个单行文本框,在这个文本框中输入的内容将会显示在“Center”位置。运行结果如下图所示。

    注意:请勿改动main()主方法和其他已有语句内容,仅在横线处填入适当语句。

    import java.awt.*;

    import java.awt.event.*;

    public class Example2_6 extends Frame

    {

    public static void main(String [] argv)

    {

    Example2_6 frame. = new Example2_6("Example2_6");

    frame, init ();

    frame.setSize(300, 300);

    frame, show ();

    }

    public Example2_6(String name)

    {

    super (name);

    addWindowListener (new WindowAdapter ()

    { public void windowClosing(WindowEvent e)

    { __________;

    }

    } );

    }

    public void init()

    {

    setLayout (new ___________);

    Label labelTitle = new Label("在文本框中输入字符串,可以在Frame. 中间显示");

    Label showTextLabel = new Label();

    TextField textField = new TextField("请在这里输入字符串");

    textField.addActionListener (new AddStringListener(showTextLabel, textField) );

    add("North", labelTitte);

    add("Center", showTextLabel);

    add("South", textField);

    }

    }

    class AddStringListener implements ActionListener

    {

    Label label;

    TextField textField;

    public AddStringListener(Label label, TextField textField)

    {

    this. label = label;

    this.textField = textField;

    }

    public void actionPerformed(ActionEvent e)

    {

    label, setText (textField. getText ());

    }

    }


    正确答案:System.exit(0) BorderLayout()或者带参数的BorderLayout(intint)也正确
    System.exit(0) BorderLayout()或者带参数的BorderLayout(int,int)也正确 解析:本题考查知识点:AWT库的使用、布局管理器的使用。
    解题思路:程序使用“labelTitle”来显示提示信息,使用“textField”来获取用户的输入,最后将用户输入的结果通过“showTextLabel”显示出来。
    Frame的关闭按钮的处理方式与JFrame的方式不相同,Frame必须手动实现退出按钮的事件处理机制,否则单击关闭按钮程序不会做出响应。
    本题的第一个空就是对退出按钮的事件响应内容。
    BorderLayout布局管理器将容器分为五个区域:North、South、East、West和Center。可以指定构件放在那个区域,但是每个区域只能放置一个构件。第二个空即是为Frame设置BorderLayout类型的布局管理器。

  • 第16题:

    You define the following regular expression of currency values:regex tx = new regex("^-?\d+(\.\d{2})?$")You are required to write code that will be used to find whether a string in the variable named Bill matches the regular expression or not. You are also required to use this code as the expression in a conditional statement and need to know which code segment to use.What should you do?()

    A.The tx.Matches(Bill)

    B.The tx.Equals(Bill)

    C.The tx.Match(Bill)

    D.The tx.IsMatch(Bill)


    参考答案:D

  • 第17题:

    Which statement is true about Kompella-based and Martina-based VPNs?()

    • A、Both use LDP
    • B、Both use BGP
    • C、Both require additional hardware.
    • D、Both use a two-label stack for forwarding.

    正确答案:D

  • 第18题:

    给出以下关于一个使用适当的字符间距的字体的TextField的表达式TextField t = new TextField("they are good",40);以下说法中()是正确的

    • A、被显示的字符串可以使用多种字体//只有一种字体
    • B、一行中最大的字符数是40//使显示的最大字符数
    • C、显示的宽度正好是40个字符宽//有可能不足 只是设置的最佳大小
    • D、用户可以编辑字符

    正确答案:D

  • 第19题:

    下列哪个选项是创建一个标识有"打开"按钮的语句()。

    • A、TextField b=new TextField("打开");
    • B、TextArea b=new TextArea("打开");
    • C、Checkbox b=new Checkbox("打开");
    • D、Button b=new Button("打开");

    正确答案:D

  • 第20题:

    import java.awt.*;   public class Test extends Frame {   public Test() {   add(new Label(“Hello”) );   add(new TextField(“Hello”) );   add(new Button(“Hello”) );   pack();   show();    }   public static void main(String args) {   new Test ();   }   }   What is the result? () 

    • A、 The code will not compile.
    • B、 A Window will appear containing only a Button.
    • C、 An IllegalArgumentException is thrown at line 6.
    • D、 A Window button will appear but will not contain the Label, TextField, or Button.
    • E、 A Window will appear containing a Label at the top, a TextField below the Label, and a Button  below the TextField.
    • F、 A Window will appear containing a Label on the left, a TextField to the right of the Label, and a button to the right of the TextField.

    正确答案:B

  • 第21题:

    You define the following regular expression of currency values: regex tx = new regex("^-?/d+(/./d{2})?$") You are required to write code that will be used to find whether a string in the variable named Bill matches the regular expression or not. You are also required to use this code as the expression in a conditional statement and need to know which code segment to use. What should you do?()

    • A、The tx.Matches(Bill)
    • B、The tx.Equals(Bill)
    • C、The tx.Match(Bill)
    • D、The tx.IsMatch(Bill)

    正确答案:D

  • 第22题:

    多选题
    Which three statements about subqueries are true?()
    A

    A single row subquery can retrieve only one column and one row.

    B

    A single row subquery can retrieve only one row but many columns.

    C

    A multiple row subquery can retrieve multiple rows and multiple columns.

    D

    A multiple row subquery can be compared by using the “>” operator.

    E

    A single row subquery can use the IN operator.

    F

    A multiple row subquery can use the “=” operator.


    正确答案: A,D
    解析: 暂无解析

  • 第23题:

    多选题
    Which of the following statements are true when creating NETBIOS names? ()
    A

    NETBIOS names can only use alphanumeric characters.

    B

    You can use a ’.’ in a NETBIOS name.

    C

    You can use an ’_’ (underscore) in a NETBIOS name.

    D

    NETBIOS names must be UPPERCASE

    E

    NETBIOS names can be a maximum of 32 characters


    正确答案: D,A
    解析: 暂无解析