com.jniwrapper.win32.gdi
Class Icon

java.lang.Object
  extended bycom.jniwrapper.Parameter
      extended bycom.jniwrapper.Pointer.Void
          extended bycom.jniwrapper.win32.Handle
              extended bycom.jniwrapper.win32.gdi.GdiObject
                  extended bycom.jniwrapper.win32.gdi.Icon
All Implemented Interfaces:
com.jniwrapper.IntegerParameter, com.jniwrapper.PointerParameter
Direct Known Subclasses:
ShellIcon

public class Icon
extends GdiObject

This class represents generic methods to work with icons.


Nested Class Summary
static class Icon.IconType
          IconType represents the enumeration of default icon types.
static class Icon.SystemIcon
           
 
Nested classes inherited from class com.jniwrapper.win32.gdi.GdiObject
GdiObject.ImageLoadParameters, GdiObject.ImageType, GdiObject.Type
 
Field Summary
 
Fields inherited from class com.jniwrapper.win32.gdi.GdiObject
GDI_ERROR, HGDI_ERROR
 
Fields inherited from class com.jniwrapper.win32.Handle
INFINITE_TIMEOUT, INVALID_HANDLE_VALUE, STATUS_ABANDONED_WAIT_0, STATUS_TIMEOUT, STATUS_WAIT_0
 
Fields inherited from class com.jniwrapper.Parameter
LICENSE_TYPE, V
 
Constructor Summary
Icon()
          Creates a NULL icon.
Icon(java.awt.Component c, javax.swing.Icon icon)
          Creates an icon from the standard Swing Icon.
Icon(java.awt.Dimension size)
          Creates a NULL icon with a specified size.
Icon(java.io.File file)
          Creates an icon from the specified file.
Icon(java.io.File file, java.awt.Dimension size)
          Creates an icon from the specified file.
Icon(Handle hInstance, java.io.File file)
          Creates an icon from the specified file.
Icon(Handle hInstance, java.lang.String iconName)
          Creates an icon from the executable (.exe) file associated with an application instance.
Icon(java.io.InputStream stream)
          Creates an icon from the specified stream.
Icon(java.io.InputStream stream, java.awt.Dimension size)
          Creates an icon from the specified stream.
Icon(long value)
           
Icon(java.lang.String iconName)
          Creates an icon from the executable (.exe) file associated with an application instance.
 
Method Summary
 int getBitCount()
           
 IconInfo getIconInfo()
          Returns the icon information.
 java.awt.Dimension getSize()
          Returns the size of the icon.
 void load(java.io.File file)
          Loads the icon from the specified file.
 void load(java.io.File file, java.awt.Dimension size)
          Loads the icon from the specified file.
 void load(Handle hInstance, java.io.File file, java.awt.Dimension size)
          Loads the icon from the specified file.
 void load(java.io.InputStream stream, java.awt.Dimension size)
          Loads the icon from the specified stream.
 void load(java.io.InputStream stream, int iconIndex)
          Loads the icon from the specified stream.
static java.util.List loadFromStream(java.io.InputStream stream)
          Loads the collection of all icons from the specified input stream.
 java.awt.image.BufferedImage toImage()
          Converts this icon to Java BufferedImage.
protected  void update()
           
 
Methods inherited from class com.jniwrapper.win32.gdi.GdiObject
deleteObject, getObject, getObjectType
 
Methods inherited from class com.jniwrapper.win32.Handle
clone, closeHandle, equals, waitFor, waitFor
 
Methods inherited from class com.jniwrapper.Pointer.Void
asFunction, asFunction, asTypedPointer, castTo, getDebugInfo, getLength, getValue, hashCode, isNull, read, setValue, toString, write
 
Methods inherited from class com.jniwrapper.Parameter
, a, a, acceptIOPerformer, asReturnValue, b, dataBufferAssigned, getAlignedLength, getAlignmentRequirement, getDataBuffer, getDataBufferOffset, indent, pop, push, read, read, setDataBuffer, toByteArray, write
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Icon

public Icon()
Creates a NULL icon.


Icon

public Icon(long value)

Icon

public Icon(java.awt.Dimension size)
Creates a NULL icon with a specified size.


Icon

public Icon(java.lang.String iconName)
Creates an icon from the executable (.exe) file associated with an application instance.

Parameters:
iconName - Name of the icon resource to be loaded.

Icon

public Icon(Handle hInstance,
            java.lang.String iconName)
Creates an icon from the executable (.exe) file associated with an application instance.

Parameters:
hInstance - Handle to an instance of the module whose executable file contains the icon to be loaded. This parameter must be NULL when a standard icon is being loaded.
iconName - Name of the icon resource to be loaded.

Icon

public Icon(java.io.File file)
Creates an icon from the specified file.

Parameters:
file - Specifies the file to load the image from.

Icon

public Icon(java.io.File file,
            java.awt.Dimension size)
Creates an icon from the specified file.

Parameters:
file - Specifies the file to load the image from.
size - Specifies the icon size.

Icon

public Icon(Handle hInstance,
            java.io.File file)
Creates an icon from the specified file.

Parameters:
hInstance - Handle to an instance of the module that contains the image to be loaded. To load an OEM image, set this parameter to zero.
file - Specifies the file to load the image from.

Icon

public Icon(java.io.InputStream stream)
     throws java.io.IOException
Creates an icon from the specified stream. This method uses the current size of this icon.

Parameters:
stream - Specifies the stream to load the icon from.

Icon

public Icon(java.io.InputStream stream,
            java.awt.Dimension size)
     throws java.io.IOException
Creates an icon from the specified stream.

Parameters:
stream - Specifies the stream to load the icon from.
size - Specifies the size of the icon to find in the stream.

Icon

public Icon(java.awt.Component c,
            javax.swing.Icon icon)
Creates an icon from the standard Swing Icon.

Parameters:
c - Specifies the component for a paintIcon method implementation. If the implementation allows null component argument, this parameter may be null.
icon - Specifies the standard Swing Icon.
Method Detail

update

protected void update()

load

public void load(java.io.File file)
Loads the icon from the specified file. This method uses the current size of this icon.

Parameters:
file - Specifies the file to load the image from.

load

public void load(java.io.File file,
                 java.awt.Dimension size)
Loads the icon from the specified file.

Parameters:
file - Specifies the file to load the image from.
size - Specifies the size of the icon to load.

load

public void load(Handle hInstance,
                 java.io.File file,
                 java.awt.Dimension size)
Loads the icon from the specified file.

Parameters:
hInstance - Handle to an instance of the module that contains the image to be loaded. To load an OEM image, set this parameter to zero.
file - Specifies the file to load the image from.
size - Specifies the size of the icon to load.

load

public void load(java.io.InputStream stream,
                 java.awt.Dimension size)
          throws java.io.IOException
Loads the icon from the specified stream.

Parameters:
stream - Specifies the stream to load the icon from.
size - Specifies the size of the icon to find in the stream.
Throws:
java.io.IOException

load

public void load(java.io.InputStream stream,
                 int iconIndex)
          throws java.io.IOException
Loads the icon from the specified stream.

Parameters:
stream - Specifies the stream to load the icon from.
iconIndex - Specifies the index of the icon in the stream.
Throws:
java.io.IOException

getIconInfo

public IconInfo getIconInfo()
Returns the icon information.

Returns:
the icon information.

getSize

public java.awt.Dimension getSize()
Returns the size of the icon.

Returns:
the size of the icon.

getBitCount

public int getBitCount()

toImage

public java.awt.image.BufferedImage toImage()
Converts this icon to Java BufferedImage.

Returns:
image instance created from this icon.

loadFromStream

public static java.util.List loadFromStream(java.io.InputStream stream)
                                     throws java.io.IOException
Loads the collection of all icons from the specified input stream.

Parameters:
stream - streams that contains icons
Returns:
list of Icon objects
Throws:
java.io.IOException