Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void flagOfSwitzerland (Graphics g, int numDots)
- {
- g.setColor(Color.red);
- g.fillRect(0,0,1000,650);
- for (int d = 1; d <= numDots; d++)
- {
- int x = rand.nextInt(1000); // random x value of each dot
- int y = rand.nextInt(650); // random y value of each dot
- if (x >= 400 && x < 800) // middle stripe requires compound condition
- g.setColor(Color.white);
- else g.setColor(Color.red);
- if (y >= 260 && y < 520) // middle stripe requires compound condition
- g.setColor(Color.white);
- else g.setColor(Color.red);
- g.fillRect(x,y,3,3);
- }
- showName(g,"Switzerland");
- }
Advertisement
Add Comment
Please, Sign In to add comment