标签:绘图//
import java.awt.*;import java.applet.*;
public class Draw extends Applet
{
public void paint(Graphics g)
{
g.setColor(Color.YELLOW);
g.drawLine(0,0,100,100);//画线从(0,0)到(100,100)
g.setColor(Color.BLUE);
g.fillRect(125,25,50,40);//画实心矩形,起点(125,25),大小50X40
g.setColor(Color.RED);
g.drawRect(225,25,50,40);//画空心矩形,起点(225,25),大小50X40
g.setColor(Color.GREEN);
g.drawRoundRect(325,25,50,40,10,8);//画圆角矩形,起点(325,25),大小50X40,圆角10X8
g.setColor(Color.ORANGE);
g.fill3DRect(25,125,50,40,true);//画一个3D效果的实心矩形,起点(25,125),大小50X40
}
}
步骤:
结果:
标签:绘图