return new Dimension(w, fontMetrics.getHeight() + MARGIN*2);
}
}, Direction.LEFTRIGHT);
Rectangle area = layout.calcDrawingArea();
area.grow(4,4); // give it a bit of margin
BufferedImage image = new BufferedImage(area.width, area.height, BufferedImage.TYPE_INT_RGB );
Graphics2D g2 = image.createGraphics();
g2.setTransform(AffineTransform.getTranslateInstance(-area.x,-area.y));
g2.setPaint(Color.WHITE);
g2.fill(area);