给出下列关于一个使用适当的字符间距的字体的TextField的表达式,则( )选项的叙述是对的。 TextField t=new TextField("they are good",40);
A.被显示的字符可以使用多朴字体
B.一行中最大的字符数是40
C.显示的宽度正好是40个字符宽
D.用户可以编辑字符
第1题:
在程序中,使用适当的布局管理器,在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());
}
}
第2题:
给出下列关于使用适当的字符间距的字体的TextField的表达式,则哪个选项的叙述是正确的? ( ) TextField t=new TextField("they are good",40);
A.被显示的字符串可以使用多种字体
B.一行中最大的字符数是40
C.显示的宽度正好是40个字符宽
D.用户可以编辑字符
第3题:
7、下列关于Text组件和TextField组件的说法中正确的是()
A.Text组件包含一个设置前景色的属性,但不能与color同时设置
B.TextField组件和Text组件都可以用obscureText 属性设置是否隐藏输入的内容
C.TextField组件的decoration属性用于设置输入框的修饰,该属性值为InputDecoration类型,以此来调整输入框的外观及提示信息等
D.TextField组件的counterText属性用于设置输入框右下方显示的文本,常用于显示输入的字符数量,但不能与counterStyle属性配合使用
第4题:
以下程序中,使用适当的布局管理器,在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 ());
}
}
第5题:
给出下列关于一个使用适当的字符间距的字体的TextField的表达式,则哪个选项的叙 述是对的? TextField t = new TextField("they are good",40);
A.被显示的字符串可以使用多种字体
B.一行中最大的字符数是40
C.显示的宽度正好是40个字符宽
D.用户可以编辑字符