Java中的绘制多边形
绘制多边形的applet程序。privateintxValue[]={20,40,120,50,10,20};privateintyValue[]={50,30,50,1...
绘制多边形的applet程序。
private int xValue[ ]={20,40,120,50,10,20};
private int yValue[ ]={50,30,50,120,90,50};
private int xVa[ ]={250,300,200,250};
private int yVa[ ]={50,100,150,50};
这是什么意思啊? 展开
private int xValue[ ]={20,40,120,50,10,20};
private int yValue[ ]={50,30,50,120,90,50};
private int xVa[ ]={250,300,200,250};
private int yVa[ ]={50,100,150,50};
这是什么意思啊? 展开
展开全部
import java.applet.*;
import java.awt.Graphics;
public class AppletDemo6 extends Applet {
private int xValue[] = { 20, 40, 120, 50, 10, 20 };
private int yValue[] = { 50, 30, 50, 120, 90, 50 };
private int xVa[] = { 250, 300, 200, 250 };
private int yVa[] = { 50, 100, 150, 50 };
public void init() {
setSize(800, 600);
}
public void paint(Graphics g) {
for (int i = 0; i < xValue.length; i++) {
g.drawLine(xValue[i], yValue[i],
xValue[i + 1 % (xValue.length - 1)], yValue[i + 1
% (yValue.length - 1)]);
}
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询