Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.Color;
- import java.awt.Graphics;
- import java.util.Random;
- public class Cubes {
- public Cube[] cubes = new Cube[5000];
- int place=0;
- public Cubes(){
- }
- public Graphics DrawNormal(Graphics g){
- int x1,x2,x3,x4,x5,y1,y2,y3,y4,y5;
- Random r = new Random();
- x1=r.nextInt(500);
- x2=r.nextInt(Math.abs(400-x1));
- x3=r.nextInt(Math.abs(300+(x1-x2)));
- x4=r.nextInt(Math.abs((400-x1)));
- x5=r.nextInt(Math.abs(200)+x4);
- y1=r.nextInt(Math.abs(400));
- y2=r.nextInt(Math.abs(300-x1));
- y3=r.nextInt(Math.abs(200+(x1-x2)));
- y4=r.nextInt(Math.abs((300-x1)));
- y5=r.nextInt(Math.abs(100)+x4);
- cubes[place]= new Cube(x1,y1,Color.red);
- place++;
- cubes[place]= new Cube(x2,y2,Color.red);
- place++;
- cubes[place]= new Cube(x3,y3,Color.red);
- place++;
- cubes[place]= new Cube(x4,y4,Color.red);
- place++;
- cubes[place]= new Cube(x5,y5,Color.red);
- place++;
- for(int i =0;i<5;i++){
- g.draw3DRect(cubes[i].x, cubes[i].y, 30, 40, true);
- }
- return g;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement