Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- PjApplication app = new PjApplication();
- app.setLayout(null);
- app.setVisible(true);
- int num = (int) (Math.random()*10)+6;
- PjOval[] list = new PjOval[num];
- for (int i = 0; i < list.length; i++){
- PjOval shape = new PjOval();
- shape.setBackground((new Color[] {Color.red, Color.blue, Color.green})[(int)(Math.random()*3)]);
- shape.setLocation((int)(Math.random()*app.getWidth() - shape.getWidth()/2), (int)(Math.random()*app.getHeight() - shape.getHeight()/2));
- app.add(shape);
- }
- }
Add Comment
Please, Sign In to add comment