public static BufferedImage createErrorImage ( int width , int height ) { BufferedImage img = new BufferedImage ( width , height , BufferedImage . TYPE_BYTE_INDEXED ) ; Graphics2D g = ( Graphics2D ) img . getGraphics ( ) ; g . setColor ( Color . red ) ; Label l = new Label ( "Error" ) ; l . layout ( g ) ; Dimension d = l . getSize ( ) ; // fill that sucker with errors for ( int yy = 0 ; yy < height ; yy += d . height ) { for ( int xx = 0 ; xx < width ; xx += ( d . width + 5 ) ) { l . render ( g , xx , yy ) ; } } g . dispose ( ) ; return img ; }
Creates an image with the word Error written in it .