Here you can find the source of createEmptyImageIcon(final int width, final int height)
Parameter | Description |
---|---|
width | width of image |
height | height of image |
public static ImageIcon createEmptyImageIcon(final int width, final int height)
//package com.java2s; //License from project: LGPL import java.awt.Graphics2D; import java.awt.image.BufferedImage; import javax.swing.ImageIcon; public class Main { /**//from w ww.ja v a2 s .c om * Creates an empty image. * * @param width width of image * @param height height of image * @return empty image */ public static ImageIcon createEmptyImageIcon(final int width, final int height) { final BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR_PRE); final Graphics2D g = image.createGraphics(); g.dispose(); return new ImageIcon(image); } }