applet在网页中显示的问题
程序代码:
import java.awt.*;
import java.applet.Applet;
import javax.swing.JApplet;
public class MoonApplet extends Applet
{
public void paint(Graphics g)
{
g.setColor(Color.red);
g.drawString("The Moon", 100,20);
int x=0,y=0;
y=this.getHeight()/4;
x=this.getWidth()/4;
int diameter=Math.min(this.getWidth()/2, this.getHeight()/2);
g.setColor(Color.yellow);
g.fillOval(x, y, diameter, diameter);
g.setColor(this.getBackground());
g.fillOval(x-20, y-20,diameter, diameter);
}
}
<html>
<applet code="MoonApplet.class" height=100 width=300>
</applet>
<html>
可是在网页中显示的只是一个小叉,这是怎么回事import java.applet.Applet;
import javax.swing.JApplet;
public class MoonApplet extends Applet
{
public void paint(Graphics g)
{
g.setColor(Color.red);
g.drawString("The Moon", 100,20);
int x=0,y=0;
y=this.getHeight()/4;
x=this.getWidth()/4;
int diameter=Math.min(this.getWidth()/2, this.getHeight()/2);
g.setColor(Color.yellow);
g.fillOval(x, y, diameter, diameter);
g.setColor(this.getBackground());
g.fillOval(x-20, y-20,diameter, diameter);
}
}
<html>
<applet code="MoonApplet.class" height=100 width=300>
</applet>
<html>
----------------解决方案--------------------------------------------------------
路过 帮顶
----------------解决方案--------------------------------------------------------
我重做了系统好了
----------------解决方案--------------------------------------------------------