/** * Gets image with desired text with Font size fontSize and desired width and height. It is * buffered. * * @param text * @param fontSize * @param textWidth * @param textHeigh * @param ascent * @return */ public BufferedImage getImageWithText( String text, Font font, int textWidth, int textHeigh, int ascent) { BufferedImage image; image = imageBuffer.getBufferedImageWithText(text, font.getSize()); if (image == null) { // System.out.println("MISS"); // load image from file image = createImageWithText(text, font, textWidth, textHeigh, ascent); // put image into buffer imageBuffer.putBufferedImageWithText(text, font.getSize(), image); } else { // System.out.println("HIT"); } return image; }