question: public BufferedImage render ( I18nFormat format ) { int imageWidth = LEGEND_TOTAL_WIDTH ; int imageHeight = calculateImageHeight ( ) ; BufferedImage image = new BufferedImage ( imageWidth , imageHeight , BufferedImage . TYPE_INT_ARGB ) ; Graphics2D graphics = ( Graphics2D ) image . getGraphics ( ) ; graphics . setRenderingHint ( RenderingHints . KEY_ANTIALIASING , RenderingHints . VALUE_ANTIALIAS_ON ) ; graphics . translate ( LEGEND_MARGIN_LEFT , 0 ) ; for ( Legend legend : legends ) { legend . draw ( graphics , format ) ; graphics . translate ( 0 , LEGEND_MARGIN_BOTTOM ) ; } return image ; }
target:  Render the legends contained in this set onto a image. The width of the image returned may vary, depending on how many columns of legends that is added. The image height can be decided by the user, but if the biggest legend is higher than imageMaxHeight, the height will automatically be set to the height of this legend.