随机坐标绘制沙漏

时间:2014-02-06 21:43:53

标签: java random draw geometric-arc hourglass

嘿我每次启动应用程序时都需要在不同位置绘制沙漏。我试过这种方式:

Random randomNum = new Random(System.currentTimeMillis());

int a1=randomNum.nextInt(500);
int a2=a1*2;
int a3=a1;
int a4=a2;

int b1=a1;
int b2=a2/2;
int b3=a2/2;
int b4=a1;

int x1points[] = {a1, a2, a3, a4};
int y1points[] = {b1, b2, b3, b4};

int ntpoints = 4;
g.fillPolygon(x1points, y1points, ntpoints);

通过这种方式看不到沙漏。有什么建议吗? JFrame&amp ;;一切都很好JPanel(另一种几何图形显示正确)。

0 个答案:

没有答案