网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

在程序中,使用适当的布局管理器,在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());

}

}


参考答案

更多 “ 在程序中,使用适当的布局管理器,在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());}} ” 相关考题
考题 在PowerPoint中,用"文本框"工具在幻灯片中添加文字时,文本框的大小和位置是确定的。此题为判断题(对,错)。

考题 在窗体上添加一个文本框Textl,然后编写下列Load事件过程,则程序运行结果是 。 Private Sub Form_LoadO Textl.Text=〞〞 Textl.SetFocus Fork=1 To 5 T=t﹡k Next k Textl.Text=t End SubA.在文本框中显示120 B.文本框中仍为空 C.在文本框中显示1 D.出错

考题 PowerPoint中,用文本框工具在幻灯片中添加图片操作,何时表示可添加文本()A、状态栏出现可输入字样B、主程序发出音乐提示C、在文本框中出现一个闪烁的插入点D、文本框变成高亮度

考题 以下程序中,使用适当的布局管理器,在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 ());}}

考题 在名为Form1的窗体上,绘制一个名为Text1的文本框。设置文本框属性,在文本框中显示“文本框”;再建立一个名为Cmd1,标题为Clear的命令按钮,如下图所示。编写适当的事件过程,使程序运行后,若单击Clear命令按钮,则清除文本框中所显示的信息。注意:文件必须存放在考生文件夹中,窗体文件名为execise5.frm,工程文件名为exeeise5.vbp。

考题 PowerPoint中,用文本框工具在幻灯片中添加文本,何时表示可添加文本()。 A、状态栏出现可输入字样B、主程序发出音乐提示C、在文本框中出现一个闪烁的竖线D、文本框变成高亮度

考题 PowerPoint中,用文本框工具在幻灯片中添加图片操作,何时表示可添加文本()。A、状态栏出现可输入宁样;B、主程序发出音乐提示;C、在文本框中出现一个闪烁的插入点:D、文本框变成高亮度。

考题 列表框应用程序。要求从文本框中输入姓名,然后按“添加”按钮,把姓名添加到列表框中;当选择列表框中某一项后,按“删除”按钮,则从列表框中删除该项;当选择列表框中某一项后,按“修改”按钮,把列表框中选取的项送往文本框且“修改”按钮变为“修改确认”。在文本框的内容修改好后,按“修改确认”按钮,再把文本框中修改后的信息送到列表框且“修改确认”按钮变为“修改”。程序运行结果下图所示。 程序如下,请补充完整。

考题 编写一个列表框应用程序,程序界面如下图所示。设“添加”、“删除”和“修改”按钮的名称定义为cmdAdd、cmdDel和cmdUpdate,列表框和文本框的名称为默认。要求从文本框输入姓名,然后按“添加”按钮把姓名添加到列表框中;当选择列表框中某一项时,按“删除”按钮,从列表框中删除;当选择列表框中某一项时,按“修改”按钮,把列表框中选取的项送往文本框且“修改”按钮变为“修改确认”。在文本框的内容修改好后,按“修改确认”按钮,再把文本框中修改的信息送到列表框且“修改确认”按钮变为“修改”。