// Draw the brushes
Iterator itr = brushes.iterator();
int x = 0;
while (itr.hasNext()) {
Brush brush = (Brush) itr.next();
Rectangle bb = brush.getBounds();
float o = maxWidth / 2.0f - bb.width / 2.0f;
g.translate((int) o, (int) o);
brush.drawPreview((Graphics2D) g, new Dimension(maxWidth, maxWidth), null);
g.translate((int) -o, (int) -o);
if (brush == selectedBrush) {
g.drawRect(0, 0, maxWidth, maxWidth);
}