更多"请写出Applet类中init( )方法的功能。"的相关试题:
[单项选择]当Applet程序中的init( )方法为下列代码时,运行后用户界面会出现什么样的情况。
public void init( )
setLayout(new BorderLayout( ));
add("North", new TextField(10));
add("Center", new Button("help"));
下面各选项中描述正确的是( )。
A. 文本框将会出现在Applet的顶上,且有10个字符的宽度
B. 按钮将会出现在Applet的正中间,且尺寸为正好能够包容help的大小
C. 文本框将会出现在Applet的顶上,从最左边一直延伸到最右边;按钮将会出现在Applet的正中央,覆盖除文本框外的所有空间
D. 按钮与文本框的布局依赖于Applet的尺寸
[填空题]Applet生命周期方法有init( )、 【15】 、stop( )和destroy( )。
[简答题]阅读下列程序,请写出程序的运行结果。
import java. applet.*;
import java.awt.*;
public class C extends Applet implements Runnable
Thread redBall,blueBall;
Graphics redPen,bluePen;
int blueSeta=0,redSeta=0;
public void init( )
setSize(250,200);
redBall=new Thread(this);
blueBall=new Thread(this);
redPen=getGraphics( );
bluePen=getGraphics( );
redPen.setColor(Color. red);
bluePen.setColor(Color. blue);
setBackground(Color. gray);
public void start( )
redBall.start( );
blueBall.start( );
public void run( )
int x,y;
while(true)
if(Thread.currentThread( )==redBall)
//以下代码为顺时针画圆
x=(int)(80.0*Math.cos(3.1415926/180.0*redSeta));
y=(int)(80.0*Math.sin(3.1415926/180.0*redSeta));
redPen.setColor(Color.gray);
redPen.fillOva
[填空题]Applet生命周期方法有init( ),【 】( ),stop( )和destroy( )。
[单项选择]当Applet程序中的init( )方法为下列代码时,运行后用户界面会出现的情况,以下描述正确的是( )。
publicvoidinit( )
setLayout(newBorderLayout( ));
add("North",newTextField(10));
add("Center",newButton("help"));
A. 文本框将会出现在Applet的顶上,且有10个字符的宽度
B. 按钮将会出现在Applet的正中间,且尺寸为正好能够包容help的大小
C. 文本框将会出现在Applet的顶上,从最左边一直延伸到最右边;按钮将会出现在 Applet的正中内,覆盖除文本框外的所有空间
D. 按钮与文本框的布局依赖于Applet的尺寸
[填空题]Applet生命周期方法有init( ),【11】( ),stop( )和destroy( )。
[填空题]Applet生命周期中的关键方法包括:init( )、start( )、stop( )和 【13】 。