import java.applet.*;
import java.awt.*;
public class GraphicsSampler extends Applet
{
Image i2=null;
Graphics g2=null;
int ww=0,hh=0;
public void init()
{
setBackground(Color.lightGray);
}
public void paint(Graphics g)
{
Rectangle r1=getBounds();
if (i2==null||ww!=r1.width ||hh!=r1.height)
{
if (g2!=null)
g2.dispose();
i2=createImage(r1.width,r1.height);
g2=i2.getGraphics();
}
g2.setColor(Color.cyan);
g2.fillArc(25, 10, 150, 80, 90, 350);
g2.setColor(Color.red);
g2.drawArc(25, 10, 150, 80, 90, 135);
g2.setColor(Color.red);
g2.drawArc(25,10,15,15,0,360);
g2.drawArc(20,5,5,5,0,360); //--------------------1
g.drawImage(i2,0,0,this);
g.setColor(Color.cyan);
g.fillArc(25, 100, 150, 80, 90, 350);
g.setColor(Color.red);
g.drawArc(25, 100, 150, 80, 90, 135);
g.setColor(Color.red);
g.drawArc(25,100,15,15,0,360);
g.drawArc(20,95,5,5,0,360); //--------------------2
}
}
在JDK1.4中第1和第2所画的圆为何不同??
在微软JAVA却正常。