com.inmethod.icon
Class PackageIcon

java.lang.Object
  extended by com.inmethod.icon.PackageIcon
All Implemented Interfaces:
Icon, Serializable

public class PackageIcon
extends Object
implements Icon

Simple icon implementation that uses images in classpath or a ResourceReference as icon source.

Author:
Matej Knopp
See Also:
Serialized Form

Constructor Summary
PackageIcon(Class<?> scope, String name)
          Creates a new icon instance.
PackageIcon(ResourceReference reference)
          Creates a new icon instance.
 
Method Summary
 int getHeight()
          Returns the icon height.
 CharSequence getUrl()
          Returns the URL of icon image.
 int getWidth()
          Returns the icon width.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PackageIcon

public PackageIcon(ResourceReference reference)
Creates a new icon instance.

Parameters:
reference - resource reference that can be used to get the icon

PackageIcon

public PackageIcon(Class<?> scope,
                   String name)
Creates a new icon instance.

Parameters:
scope - Class relative to which the icon is placed in classpath
name - Icon name relative to the scope class
Method Detail

getHeight

public int getHeight()
Returns the icon height.

Specified by:
getHeight in interface Icon
Returns:
icon height (in pixels) or -1 if the height can not be determined

getWidth

public int getWidth()
Returns the icon width.

Specified by:
getWidth in interface Icon
Returns:
icon width (in pixels) or -1 if the width can not be determined

getUrl

public CharSequence getUrl()
Returns the URL of icon image.

Specified by:
getUrl in interface Icon
Returns:
icon URL


Copyright © 2007–2014 inMethod s.r.o.. All rights reserved.