Creates a transparent icon. : Icon « 2D Graphics GUI « Java






Creates a transparent icon.

   


import java.awt.image.BufferedImage;
import java.util.Arrays;
import javax.swing.Icon;
import javax.swing.ImageIcon;


public final class ImageUtils
{


  /**
   * Creates a transparent image.  These can be used for aligning menu items.
   *
   * @param width  the width.
   * @param height the height.
   * @return the created transparent image.
   */
  public static BufferedImage createTransparentImage (final int width, final int height)
  {
    return new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
  }

  /**
   * Creates a transparent icon. The Icon can be used for aligning menu items.
   *
   * @param width  the width of the new icon
   * @param height the height of the new icon
   * @return the created transparent icon.
   */
  public static Icon createTransparentIcon (final int width, final int height)
  {
    return new ImageIcon(createTransparentImage(width, height));
  }
}

   
    
    
  








Related examples in the same category

1.Create a dynamic icon
2.A simple application to test the functionality of the OvalIcon classA simple application to test the functionality of the OvalIcon class
3.Icon DisplayerIcon Displayer
4.Implement the Icon interfaceImplement the Icon interface
5.Calendar Page icons with Weekday, Day and MonthCalendar Page icons with Weekday, Day and Month
6.MemImage is an in-memory icon showing a Color gradientMemImage is an in-memory icon showing a Color gradient
7.Example of an icon that changes formExample of an icon that changes form
8.Custom Icon DemoCustom Icon Demo
9.Create Image Icon from PNG file
10.Reading an Image or Icon from a File
11.Draw an Icon object
12.Plain Color Icon
13.Color Icon
14.Arrow Icon
15.Icon Line
16.Return a filled oval as an Icon
17.Layered Icon
18.An icon for painting a square swatch of a specified Color.
19.An empty icon with arbitrary width and height.
20.Transparent icon with no content
21.Icon Codec