参数:
xPoints
-
x
坐标数组。
yPoints
-
y
坐标数组。
nPoints
- 点的总数。
下面是我的demo程序:
import java.awt.Color;
import java.awt.Graphics;
/**
*
* @author lazy_p
* @date 2010-3-18
*
* 立体图形demo
*
*/
public class ThreeDrec extends java.applet.Applet {
private static final long serialVersionUID = -2427989261965982016L;
public void init() {
resize(200, 200);
} // 初 始 化 作 图 区域
public void paint(Graphics g) {
g.setColor(Color.red);
g.drawPolygon(new int[] { 30, 90, 100, 40 },
new int[] { 30, 30, 10, 10 }, 4); // 画 一个长方形
g.setColor(new Color(1).GRAY);
g.fillPolygon(new int[] { 30, 90, 100, 40 },
new int[] { 30, 30, 10, 10 }, 4);// 填充 一个长方