if(x>clipRect.width) {
if(x+maxWidth>clipRect.width) {
	public void paint(Graphics g) {		Rectangle clipRect = g.getClipBounds();		int x=0,y=0;				g.setColor(Color.white);		g.fillRect(clipRect.x, clipRect.y, clipRect.width, clipRect.height);				((Graphics2D)g).setRenderingHint(RenderingHints.KEY_ANTIALIASING,                RenderingHints.VALUE_ANTIALIAS_ON);		g.setColor(Color.black);				if(brushes.indexOf(selectedBrush)>0) {			int index = brushes.indexOf(selectedBrush);			int bx =  index % (this.getPreferredSize().width/maxWidth);			int by =  index / (this.getPreferredSize().width/maxWidth);			g.drawRect(bx*maxWidth,by*maxWidth,maxWidth,maxWidth);		}		//DRAW THE STANDARD SIZES		Iterator itr = brushes.iterator();		while(itr.hasNext()) {			Brush b = (Brush) itr.next();			Rectangle bb = b.getBounds();			b.paint(g, x+((maxWidth/2)-bb.width/2), y+((maxWidth/2)-bb.width/2));			x+=maxWidth;			if(x>clipRect.width) {				x=0;				y+=maxWidth;			}		}					}