b.paint(g, x + ((maxWidth / 2) - bb.width / 2), y + ((maxWidth / 2) - bb.width / 2));
b.drawPreview((Graphics2D)g, null);
    public void paint(Graphics g) {        Rectangle clipRect = g.getClipBounds();        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);        // Draw the brushes        Iterator itr = brushes.iterator();        int x = 0, y = 0;        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));            if (b == selectedBrush) {                g.drawRect(x, y, maxWidth, maxWidth);            }            x += maxWidth;            if (x + maxWidth > getWidth()) {                x = 0;                y += maxWidth;            }        }    }