填空题

编写同时具有Applet与Application特征的程序,具体的方法是:作为Application要定义main()方法,并且把main()方法所在的类定义为一个 【13】 类,为使该程序成为一个Applet,main()方法所在的这个类必须继承Applet类或JApplet类。

【参考答案】

public
<上一题 目录 下一题>
热门 试题

填空题
有如下代码片段,请在画线处填入正确的代码,使程序运行正确。import javax.swing.*;import java.awt.*;import java.event.*;public class JAppletTest extends 【12】 {public void init(){Container contentPane = getContentPane( );Icon icon = new ImageIcon( swing.gif , A GIF on a swing );JLabel label = new JLabel( Swing! , icon, Swingconstants. CENTER);contentPane.add(label, BorderLayout. CENTER);}}
填空题
下面ChangeTitle()中对b1和b2按键构造监听器,实现当按下b1键时标题变为Students,当按下b2键时标题变为Teachers。添加空缺的语句。…public ChangeTitle(){super( Title Bar );b1.addActionListener(this);【11】 ;Jpanel pane=new Jpanel();Pane.add(b1);Pane.add(b2);SetContentPane(pane);}public void actionPerformed(ActionEvent evt){Object sourve=evt.getSource();if(sourve==b1)setTitle( Students );else if(source==b2)setTitle( Teachers );repaint();}…
相关试题
  • 下列JApplet使用重写paintComponet()方法...
  • 现在有Java Applet小程序的源程序文件MyAp...
  • 任何非空树中有且仅有—个结点没有前驱结点...