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:
IntegerParameter
Direct Known Subclasses:
ShellIcon

public class Icon
extends GdiObject

This class represents generic methods to work with Icon.


Nested Class Summary
static class Icon.IconType
          IconType represents 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.Parameter
LICENSE_TYPE, V
 
Constructor Summary
Icon()
          Creates a NULL icon.
Icon(java.awt.Component c, javax.swing.Icon icon)
          Create 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
 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.
 java.awt.image.BufferedImage toImage()
          Converts this icon to Java BufferedImage.
protected  void updateSize()
           
 
Methods inherited from class com.jniwrapper.win32.gdi.GdiObject
deleteObject, getObject, getObjectType
 
Methods inherited from class com.jniwrapper.win32.Handle
clone, closeHandle
 
Methods inherited from class com.jniwrapper.Pointer.Void
asFunction, asFunction, asTypedPointer, castTo, equals, getDebugInfo, getLength, getValue, hashCode, isNull, read, setValue, toString, write
 
Methods inherited from class com.jniwrapper.Parameter
acceptIOPerformer, asReturnValue, dataBufferAssigned, getAlignedLength, getAlignmentRequirement, getDataBuffer, getDataBufferOffset, indent, pop, push, 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)
Create an icon from the standard swing Icon.

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

updateSize

protected void updateSize()

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:
icon information.

getSize

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

Returns:
the size of the icon.

toImage

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

Returns:
image instance created from this icon.