单选题 Java
题号 #2247306

当一个Applet所在的Web页面被其他页面覆盖后,不可能被调用的Applet方法是(  )。

进入在线模考

参考答案

B

答案解析

B。【解析】在Java Applet的生命周期中,共有4种状态,即4种方法:init()、start()、stop()和destory()。在Applet装载时,调用init()通知该Applet已被加载到浏览器中,使Applet执行一些基本初始化操作。

你可能感兴趣的试题

A.param image,"flower.gif">
B.<param image value=flower.gif>
C.<param name=image value="flower.gif">
D.<param name="image"value="flower.gif">
3 本题是一个Applet,页面上有一个按钮“请单击”,单击该按钮后弹出一个对话框,对话框上有三个按钮“橙色”、“蓝色”和“红色”,单击其中任意一个按钮,则可以将对话框的背景色设置为按钮名称所对应的颜色。
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class java2 extends JApplet
{
private JFrame framet;
        ()
{
frame=new JFrame();
frame.setTitle("java2");
frame.setSize(300,200);
frame.getContentPane().add(new ButtonPanel
());
JButton PopButton=new JButton("请单击");
getContentPane().add(PopButton);
PopButtom addActionListener(new ActionListener();
{
public void actionPerformed(ActionEvent evt)
{
if(frame.isVisible())frame.setVisible(false);
else         ;
}
});
}
}
class ButtonPanel extends JPanel
{
private class ColorAction implements ActionLis-
tener
{
private Color backgroundColor;
public void actionPerformed(ActionEvent action-
event)
{
setBackground(backgroundColor);
repaint();
}
public ColorAction(Color color)
{
backgroundColor=color;
}
}
public ButtonPanel()
{
JButton jbutton=new JButton("橙色");
JButton jbuttonl=new JButton("蓝色");
JButton jbutton2=new JButton("红色");
add(jbutton);
add(jbuttonl);
add(jbutton2);
ColorAction coloraction=new ColorAction(Color.orange);
ColorAction coloractionl=new ColorAction(Color.blue);
ColorAction coloraetion2=new ColorAction(Color.red);
ibutton.addActionListener(coloraction);
ibuttonl.addActionListener(coloractionl);
jbutton2.addActionListener(coloraction2);
}
}
找试题 · 找答案 · 找资料 在线模考