单选题在Java语言中,下面是main()方法的部分代码:    Frame f = new Frame("My Frame");   f.setSize(100,100);    为在屏幕显示f,应增加的代码是()。Af.appear();Bf.setForeground();Cf.setVisible();Df.enable();

单选题
在Java语言中,下面是main()方法的部分代码:    Frame f = new Frame("My Frame");   f.setSize(100,100);    为在屏幕显示f,应增加的代码是()。
A

f.appear();

B

f.setForeground();

C

f.setVisible();

D

f.enable();


参考解析

解析: 暂无解析

相关考题:

在Java语言中,Frame默认的布局管理器是()。 A.BorderLayoutB.FlowLayoutC.GridLayoutD.GridBagLayout

在Java语言中,下面是main()方法的部分代码:Framef=newFrame(MyFrame);f.setSize(100,100);为在屏幕显示f,应增加的代码是()。 A.f.appear();B.f.setForeground();C.f.setVisible();D.f.enable();

● 下面设置框架的 HTML 代码将浏览器窗口分为 (69) 个部分。frameset cols="25%,*"frame. src="menu.htm" scrolling="no" name="Left"frame. src="page1.htm" scrolling="auto" name="Main"/frameset(69)A.1B.2C.3D.4

请完成下列Java程序。程序的执行结果是生成一个具有一个按钮的窗体,并且按钮的标签是“欢迎参加全国计算机等级考试—Java部分!”字样。注意:请勿改动main()主方法和其他已有的语句内容,仅在下划线处填入适当的语句。import java.awt.*;import java.awt.event.*;public class TestActionEvent{public static void main(String args[]){Frame. f=new Frame("Test");Button b=new Button("欢迎参加Java考试!");TestListener testmonitor=new TestListener();Monitor bh=new Monitor();b.addActionListener(bh);f.addwindowListener(testmonitor);f.add(b);f.setSize(150,100);f.setVisible(true);}}class Monitor ___________ ActionListener{public void actionPerformed(ActionEvent e){System.out.println("a button has been pressed");}}class TestListener__________WindowAdapter{public void windowClosing(WindowEvent e){System.exit(1);}}

请选择正确的语句填入下列程序的横线处。 import java.awt.*; public class ex40 { static Frame. f; public static void main(String[] args) { f = new Frame("ex40"); MenuBar mb = new MenuBar(); f.setMenuBar (mb); Menu m1 = new Menu("menu"); ______ m1.add (mil); mb. add (m1); f. setSize (200, 200); f. setVisible (true); } }A.Menu mil = new MenuItem("iteml");B.MenuItem mil = new MenuItem("iteml");C.Menu mil = new MenuItem("iteml");D.Menu mil = MenuItem("iteml");

下列语句中所使用的布局管理器,当改变容器大小,组件大小不会随着一起改变的是A.Frame. frame1=new Frame("FlowLayout");B.Frame. frame1=new Frame("BorderLayout");C.frame1=new Frame("example"); frame1.setLayout(new BorderLayout());D.frame1.setLayout(new GridLayout(2,3));

下列语句中所使用的布局管理器,当改变容器大小,组件大小不会随着一起改变的是A.Frame. frame1=naew Frame("FlowLayout");B.Frame. frame1-new Frame("BorderLayout");C.frame1=new Frame("example"); frame1.setLayout(new BorderLayout ());D.frame1.setLayout(new GridLayout(2,3));

下面哪个语句是正确的 ( )A.Object o=new Button("A");B.Button b=new Object("B");C.Panel p=new Frame();D.Frame. f=new Panel();

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

下面代码中为横向排列多个窗口的是( )。A.<frameset cols=20%,*> <frame. src="A.html"> <framesetrows=30%,50%*> <frame. src="B.html"> <frame. src="C.html"> </frameset> </frameset>B.<frameset cols=30%,70%> <frame. src="A.html"> <frame. src="B.html"> </frameset>C.<frameset rows=25%,75%> <frame. src="A.html"> <frame. src="B.html"> </frameset>D.<frameset rows=20%,*> <frame. src="A.html"> <frameset cols=30%,50%*> <frame. src="B.html"> <frame. src="C.html"> </frameset> </frameset>

选择正确的语句填在下列程序的横线处。 import java.awt.*; import java.awt.event.*; public class ex30 { Frame. f; public static void main(String[] args) { ex30 e = new ex30(); e. te st ( ); } public void test() { f = new Frame("ex30"); ______ f.paok(); f.setVisible(true); } class MyWindowListener extends WindowAdapter { public void windowClosing(WindowEvent e) { System.exit(1); } } }A.f.addWindowListener(new MyWindowtistener());B.f.addWindowListener(MyWindowListener());C.f.addWindowAdapter(new MyWindowListener());D.addWindowListener(new MyWindowListener());

请完善程序(程序文件名:Java_3.java)并进行调试。请在下画线处填入正确内容,然后删除下画线。请勿删除注释行和其他已有的语句内容。[题目要求]生成下面左边图形界面,单击图中的New按钮,弹出如右图所示的对话框。源程序:import java.awt.*;import java.awt.event.*;import javax.swing.*;public class Java_3 {public static void main(String[] args) {MulticastFrame. frame=new MulticastFrame();frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);frame.show();}}class MulticastFrame. extends JFrame. {public MulticastFrame() {setTitle("MulticastTest");setSize(WIDTH,HEIGHT);MulticastPanel panel=new MulticastPanel();Container contentPane=getContentPane();contentPane.add( (1) );}public static final int WIDTH=300;public static final int HEIGHT=200;}class MulticastPanel extends JPanel }public MulticastPanel() {JButton newButton=new JButton("New");add(newButton);ActionListener newListener=new ActionListener() {public void actionPerformed(ActionEvent event) {makeNewFrame();}};newButton.addActionListener(newListener);closeAllButton=new JButton("Close all");add(closeAllButton);}private void makeNewFrame() {final BlankFrame. frame=new BlankFrame();frame.show();ActionListener closeAllListener=new ActionListener() {public void actionPerformed(ActionEvent event) {frame. (2) (); //使窗口隐藏或消除}};closeAllButton.addActionListener( (3) );}private JButton closeAllButton;}Class BlankFrame. extends JFrame. {public BlankFrame() {(4) ++;setTitle("Frame"+counter);setSize(WIDTH,HEIGHT);setLocation(SPACING*counter,SPACING*counter);}public static final int WIDTH=200;public static final int HEIGHT=150;public static final int SPACING=30;private static int counter=0;}

选择正确的语句填入下列程序的横线处。 import java.awt.*; public class ex26 { public static void main(String[] args) { Frame. f = new Frame("ex26"); MenuBar mb = new MenuBar(); ______ Menu m1 = new Menu("menu1"); Menu m2 = new Menu("menu2"); mb. add (ml); mb. add (m2); f.setSize(300, 100); f. setVisible (true); } }A.setMenuBar(mb);B.mb.setMenuBar(f);C.f. setMenuBar(mb);D.mb.setMenuBar0;

选择正确的语句填入下列程序的横线处。 import java.awt.*; import java.awt.event.*; public class ex21 { static Frame. f; static FileDialog fd; public static void main(String[] args) { f = new Frame("ex21"); ______ fd. setVisible (true); System.out.println (fd.getFile ()); } }A.new FileDialog(f, "FileDialog");B.new FileDialog("FileDialog");C.fd = new FileDialog(f, "FileDialog");D.fd = new FileDialog("FileDialog");

本题中,生成一个窗口,该窗口的长、宽为屏幕长、宽的一半,并且窗口的大小不能改变。import java.awt.*;import javax.swing.*;public class java2{public.static void main(String[]args){FrameSize frame=new FrameSize();frame.setDefaultCloseoperation(JFrame.EXITON_CLOSE);frame.show();}}class FrameSize extends JFrame{public FrameSize(){setTitle("java2");Toolkit tk=Toolkit.getDefaultToolkit();Dimension screenSize=int screenHeight=screenSize.height;int screenWidth=screenSize.width;setSize(screenWidth/2,sereenHeight/2);;}

下列语句中使用的布局管理器,当改变容器大小,组件大小不会随着一起改变的选项是( )。A.Frame. f=new Frame("FlowLayou");B.Frame. f=new Frame("BorderLayout");C.f=new Frame("example");f.setLayout(new BorderLayout());D.f.setLayout(new GridLayout(2,3));

有以下HTML代码,在浏览器中显示正确的是( )。htmlframeset rows=25%,50%,25%frame. src=/html/frame_A.htmlframe. src=/html/frame_B.htmlframe. src=/html/frame_C.html/frameset/html

● 以下是某网页框架设置的部分代码,该代码将页面分成了 (61)个区域。frameset cols="30%,*,*"frame. src='f1.html" name=main……frameset rows="120,*"frame. src='f2.html" name=left……/frameset/frameset(61)A. 2B. 3C. 4D. 5

以下是某网页框架设置的部分代码,该代码将页面分成了______个区域。<frameset cols="30%,*,*"><frame src='f1.html"name=main><frameset rows="120,*"><frame src='f2.html"name=left>…</frameset></frameset>A.2B.3C.4D.5

A new frame-relay network is being implemented and inverse ARP does not appear to be operating correctly. Which alternative command can be used to provide connectivity?()A、frame-relay arpB、frame-relay mapC、frame-relay interface-dlciD、frame-relay lmi-typeE、frame-relay pvc

在Java语言中,Frame默认的布局管理器是()。    A、BorderLayoutB、FlowLayoutC、GridLayoutD、GridBagLayout

在Java语言中,下面是main()方法的部分代码:    Frame f = new Frame("My Frame");   f.setSize(100,100);    为在屏幕显示f,应增加的代码是()。 A、f.appear();B、f.setForeground();C、f.setVisible();D、f.enable();

import java.awt.*;   public class X extends Frame {   public static void main (String args) {   X x = new X();   x.pack();   x.setVisible(true);   }  public X() {   setLayout (new BordrLayout());   Panel p = new Panel ();   add(p, BorderLayout.NORTH);   Button b = new Button (“North”);   p.add(b):   Button b = new Button (“South”);   add(b1, BorderLayout.SOUTH):   }   }   Which two statements are true?()A、 The buttons labeled “North” and “South” will have the same width.B、 The buttons labeled “North” and “South” will have the same height.C、 The height of the button labeled “North” can very if the Frame is resized.D、 The height of the button labeled “South” can very if the Frame is resized.E、 The width of the button labeled “North” is constant even if the Frame is resized.F、 The width of the button labeled “South” is constant even if the Frame is resized.

多选题import java.awt.*;   public class X extends Frame {   public static void main (String args) {   X x = new X();   x.pack();   x.setVisible(true);   }  public X() {   setLayout (new BordrLayout());   Panel p = new Panel ();   add(p, BorderLayout.NORTH);   Button b = new Button (“North”);   p.add(b):   Button b = new Button (“South”);   add(b1, BorderLayout.SOUTH):   }   }   Which two statements are true?()AThe buttons labeled “North” and “South” will have the same width.BThe buttons labeled “North” and “South” will have the same height.CThe height of the button labeled “North” can very if the Frame is resized.DThe height of the button labeled “South” can very if the Frame is resized.EThe width of the button labeled “North” is constant even if the Frame is resized.FThe width of the button labeled “South” is constant even if the Frame is resized.

单选题现有:  package mypack;      import java.awt.Color;  import java.awt.FlowLayout;      import javax.swing.JButton;      import javax.swing.JFrame;      import javax.swing.JPanel;  public class ButtList extends JFrame  {      public static void main(String[] args)  {      ButtList bl  =new ButtList();     }  ButtList(){  JPanel pl=new JPanel();  pl.setBackground (Color.pink);      p1.add(new JButton("one"));      p1.add(new JButton("Two"));     p1.add(new JButton("Three"));      add("South",p1);  setLayout(new Fl.wLayout());      setSize(200,200);      setVisible(true);     }     }  上述代码运行后的显示效果是哪项?()A3个按钮从左到右排列在Frame的底部B3个按钮从左到右排列在Frame的顶部C按钮无法显示D只有按钮Three显示出来并占据Frame整个区域

单选题在Java语言中,Frame默认的布局管理器是()ABorderLayoutBFlowLayoutCGridLayoutDGridBagLayout