Java Swing Icon emptyIcon(final int width, final int height)

Here you can find the source of emptyIcon(final int width, final int height)

Description

Returns an icon with a given size and no content.

License

LGPL

Parameter

Parameter Description
width icon width
height icon height

Declaration

public static Icon emptyIcon(final int width, final int height) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

import java.awt.Component;

import java.awt.Graphics;

import javax.swing.Icon;

public class Main {
    /**/*  w w w.  ja v a  2  s  .co  m*/
     * Returns an icon with a given size and no content.
     *
     * @param  width   icon width
     * @param  height  icon height
     */
    public static Icon emptyIcon(final int width, final int height) {
        return new Icon() {
            public int getIconWidth() {
                return width;
            }

            public int getIconHeight() {
                return height;
            }

            public void paintIcon(Component c, Graphics g, int x, int y) {
            }
        };
    }
}

Related

  1. createIconFromStream(InputStream input)
  2. createTransparentIcon()
  3. createTransparentIcon(final int width, final int height)
  4. createTransparentIcon(int width)
  5. darken(Icon icon)
  6. getApplicationIcons()
  7. getBadgedIcon(Icon icon, Icon badge)
  8. getbtnIcon(String iconpath)
  9. getbtniconpresspress(String Iconpath1, String pressIconpath2, String pressIconpath3)