import java.awt.*; import java.util.*; public class Bubble { private int x,y,size; private double incAmount; private Color c; public Bubble(Random g, int xsize, int ysize) { x=g.nextInt(xsize-100)+50; y=g.nextInt(ysize-150)+50; size=g.nextInt(20)+10; incAmount=0; c=new Color(g.nextInt(200),g.nextInt(200),g.nextInt(200)); } public void draw(Graphics g) { g.setColor(c); g.fillOval(x,y,size,size); } public int getSize() {return size;} public int getX() {return x;} public int getY() {return y;} public boolean collides(Bubble other) { int x1=x+size/2; int y1=y+size/2; int x2=other.getX()+other.getSize()/2; int y2=other.getY()+other.getSize()/2; int r1=size/2; int r2=other.getSize()/2; if(Math.abs(x1-x2)1) { size++; incAmount=0; } } }