首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Eclipse开发 >

怎么在HTML中运行APPLET

2011-11-27 
如何在HTML中运行APPLETimportjava.applet.*importjava.awt.*importjava.awt.event.*publicclassoneApp

如何在HTML中运行APPLET
import   java.applet.*;
import   java.awt.*;
import   java.awt.event.*;
public   class   oneApp   extends   Applet   implements   ActionListener{
      TextField   t1=new   TextField(5);
      TextField   t2=new   TextField(5);
      TextField   t3=new   TextField(5);
      Button   btn=new   Button( "发送 ");
      public   void   init(){
      add(t1);add(t2);add(t3);add(btn);
      btn.addActionListener(this);
      }
      public   void   actionPerformed(ActionEvent   e){
      anotherApp   another=(anotherApp)getAppletContext().getApplet( "anotherApp ");
      if(another!=null){
      another.draw(Integer.parseInt(t1.getText().trim()),Integer.parseInt(t1.getText().trim()),Integer.parseInt(t1.getText().trim()));
      Integer.parseInt(t1.getText().trim());
      }
      }
}
import   java.applet.*;
import   java.awt.*;
import   java.awt.event.*;
public   class   anotherApp   extends   Applet{
    public   void   draw(int   x,int   y,int   r){
    Graphics   g=this.getGraphics();
    g.drawOval(x-r,   y-r,   2*r,   2*r);
    }
}
<html>
<head>
</head>
<body   bgcolor= "#000000 ">
<center>
<applet   code= "oneApp.class "   width= "200 "   height= "150 "> </applet>
<applet   name= "anotherApp "   code= "anotherApp.class "   width= "200 "   height= "150 ">
</applet>
</center>
</body>
</html>
结果是APPLET并没有运行
请问是什么原因
请大家帮忙出主意
到底如何运行APPLET
请您说详细点

[解决办法]
APPLETVIEVER
或直接HTML中嵌入

热点排行