double resize = (iconSize - 8)
/ (bounds.getWidth() > bounds.getHeight() ? bounds
.getWidth() : bounds.getHeight());
// resize graphics
ShapeModel newShape = shape.clone();
newShape.moveToCenter();
newShape.scale(resize, resize);
// now move it to centre of the icon
newShape.translate(iconSize / 2, iconSize / 2);