user3235376
user3235376

Reputation: 87

Draw hourglass in random coordinates

Hey I need to draw an hourglass in different locations each time I start my app. I tried this way:

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);

Hourglass isn't visible this way. Any advices? Everything's fine with JFrame & JPanel (another geometrics are showed right way).

Upvotes: 0

Views: 141

Answers (0)

Related Questions