Guest User

Untitled

a guest
Jan 24th, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. {
  2. PjApplication app = new PjApplication();
  3. app.setLayout(null);
  4. app.setVisible(true);
  5. int num = (int) (Math.random()*10)+6;
  6. PjOval[] list = new PjOval[num];
  7. for (int i = 0; i < list.length; i++){
  8. PjOval shape = new PjOval();
  9. shape.setBackground((new Color[] {Color.red, Color.blue, Color.green})[(int)(Math.random()*3)]);
  10. shape.setLocation((int)(Math.random()*app.getWidth() - shape.getWidth()/2), (int)(Math.random()*app.getHeight() - shape.getHeight()/2));
  11. app.add(shape);
  12. }
  13. }
Add Comment
Please, Sign In to add comment