高手帮我运行这个APPLET!不能运行!!!!
package yan1;
import javax.swing.*;
import java.awt.*;
class Yay1 extends JApplet{
JPanel obj;
public Yay1(){
obj=new JPanel();
getContentPane().add(obj);
}
}
class Yay2 extends Yay1{
JButton obj1;
JButton obj2;
JButton obj3;
JButton obj4;
JButton obj5;
public Yay2(){
obj1=new JButton( "an niou 1 ");
obj2=new JButton( "an niou 2 ");
obj3=new JButton( "an niou 3 ");
obj4=new JButton( "an niou 4 ");
obj5=new JButton( "an niou 5 ");
obj.add(obj1);
obj.add(obj2);
obj.add(obj3);
obj.add(obj4);
obj.add(obj5);
}
}
class Yay3 extends Yay2{
FlowLayout layout;
public Yay3(){
layout=new FlowLayout(FlowLayout.LEFT,10,10);
obj.setLayout(layout);
}
}
public class Yan2 extends Yay3
{ public void init()
{ new Yan2();
}
}
------解决方案--------------------因为用了package yan1;
所以编译好的.class(4个文件)文件应该在.html文件的目录的(当前目录)yan1的文件夹里
之后html也得改成
<html>
<body>
<applet code = "yan1\Yan2.class " width = 400 height = 300>
</applet>
</body>
</html>
在我的机器上能后运行