com.tensegrity.gui.swt.icon
Class SwtIcon

java.lang.Object
  extended bycom.tensegrity.gui.swt.icon.SwtIcon
All Implemented Interfaces:
Disposable
Direct Known Subclasses:
VisualGraphObjectSwtIcon

public class SwtIcon
extends java.lang.Object
implements Disposable

A SwtIcon is a simple wrapper around an Image and is used for example in order to create repository items.

When creating an instance of this class an Image is internally created and can be accessed through the getIcon() method.

Call the dispose() method once instances of this class are no longer necessary. This ensures that resources internally held are freed.

Version:
$Id: SwtIcon.java,v 1.4 2005/03/24 09:31:34 SebastienGuyon Exp $
Author:
S�bastien Guyon
See Also:
VisualGraphObjectSwtIcon

Constructor Summary
SwtIcon(org.eclipse.swt.graphics.Device device, int width, int height)
           Creates a SwtIcon of the given width and height.
 
Method Summary
 void dispose()
           Use this method in order to dispose the SWT resources held by instance of classes implementing the Disposable interface.
 org.eclipse.swt.graphics.Device getDevice()
          Returns the device used to create this Icon
 int getHeight()
          Returns the height of the Icon
 org.eclipse.swt.graphics.Image getIcon()
          Returns the actual Image representing this icon
 org.eclipse.swt.graphics.Rectangle getSize()
          Returns the size of this Icon
 int getWidth()
          Returns the width of this icon
 void setIcon(org.eclipse.swt.graphics.Image icon)
           Set the Image which actually represents this Icon
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SwtIcon

public SwtIcon(org.eclipse.swt.graphics.Device device,
               int width,
               int height)

Creates a SwtIcon of the given width and height. The passed device is required in order to create the actual Image that renders the icon.

Parameters:
device - a Device used to create the actual Image that renders the icon
width - the icon width
height - the icon height
Method Detail

getHeight

public int getHeight()
Returns the height of the Icon

Returns:
int the height in pixel.

getSize

public org.eclipse.swt.graphics.Rectangle getSize()
Returns the size of this Icon

Returns:
a Rectangle representing the size of this icon

getWidth

public int getWidth()
Returns the width of this icon

Returns:
int the width in pixel

toString

public java.lang.String toString()

getDevice

public org.eclipse.swt.graphics.Device getDevice()
Returns the device used to create this Icon

Returns:
the device used to create this Icon

getIcon

public org.eclipse.swt.graphics.Image getIcon()
Returns the actual Image representing this icon

Returns:
the actual Image representing this icon

setIcon

public void setIcon(org.eclipse.swt.graphics.Image icon)

Set the Image which actually represents this Icon

Parameters:
icon - the new Image for this icon

dispose

public void dispose()
Description copied from interface: Disposable

Use this method in order to dispose the SWT resources held by instance of classes implementing the Disposable interface.

Specified by:
dispose in interface Disposable


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.