See the source LabelRenderTest.java for this thread . The label, after all, is drawn on the screen, but before displaying it, it is displayed before the BufferedImage .

Important source line:
textLabel.setSize(textLabel.getPreferredSize());
source share