Groovy Documentation

com.wordpress.tipsforjava.swing
[Java] Class TileIcon

java.lang.Object
  javax.swing.ImageIcon
      com.wordpress.tipsforjava.swing.TileIcon

public class TileIcon
extends ImageIcon

@(#)TileIcon.java 1.0 04/19/12


Nested Class Summary
enum TileIcon.TileMode

The type of the tiling mode

 
Field Summary
private TileIcon.TileMode tileMode

@(#)TileIcon.java 1.0 04/19/12

 
Constructor Summary
TileIcon(byte[] imageData)

Creates a TileIcon from an array of bytes.

TileIcon(byte[] imageData, String description)

Creates a TileIcon from an array of bytes.

TileIcon(Image image)

Creates a TileIcon from the image.

TileIcon(Image image, String description)

Creates a TileIcon from the image.

TileIcon(String filename)

Creates a TileIcon from the specified file.

TileIcon(String filename, String description)

Creates a TileIcon from the specified file.

TileIcon(URL location)

Creates a TileIcon from the specified URL.

TileIcon(URL location, String description)

Creates a TileIcon from the specified URL.

 
Method Summary
int getIconHeight()

Overridden to return 0.

int getIconWidth()

Overridden to return 0.

TileIcon.TileMode getTileMode()

Returns the tiling mode of this TileIcon

void paintIcon(Component c, Graphics g, int x, int y)

Paints the icon.

void setTileMode(TileIcon.TileMode tileMode)

Sets the tiling mode.

TileIcon valueOf(String name)

Returns the enum constant of this type with the specified name.

TileIcon[] values()

Returns an array containing the constants of this enum type, in the order they are declared.

 
Methods inherited from class ImageIcon
toString, getDescription, getAccessibleContext, getIconWidth, getIconHeight, setDescription, getImage, paintIcon, getImageLoadStatus, setImage, setImageObserver, getImageObserver, wait, wait, wait, equals, hashCode, getClass, notify, notifyAll
 
Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll
 

Field Detail

tileMode

private TileIcon.TileMode tileMode
@(#)TileIcon.java 1.0 04/19/12


 
Constructor Detail

TileIcon

public TileIcon(byte[] imageData)
Creates a TileIcon from an array of bytes.
Parameters:
imageData - an array of pixels in an image format supported by the AWT Toolkit, such as GIF, JPEG, or (as of 1.3) PNG
See Also:
ImageIcon.ImageIcon


TileIcon

public TileIcon(byte[] imageData, String description)
Creates a TileIcon from an array of bytes.
Parameters:
imageData - an array of pixels in an image format supported by the AWT Toolkit, such as GIF, JPEG, or (as of 1.3) PNG
description - a brief textual description of the image
See Also:
ImageIcon.ImageIcon


TileIcon

public TileIcon(Image image)
Creates a TileIcon from the image.
Parameters:
image - the image
See Also:
ImageIcon.ImageIcon


TileIcon

public TileIcon(Image image, String description)
Creates a TileIcon from the image.
Parameters:
image - the image
description - a brief textual description of the image
See Also:
ImageIcon.ImageIcon


TileIcon

public TileIcon(String filename)
Creates a TileIcon from the specified file.
Parameters:
filename - a String specifying a filename or path
See Also:
ImageIcon.ImageIcon


TileIcon

public TileIcon(String filename, String description)
Creates a TileIcon from the specified file.
Parameters:
filename - a String specifying a filename or path
description - a brief textual description of the image
See Also:
ImageIcon.ImageIcon


TileIcon

public TileIcon(URL location)
Creates a TileIcon from the specified URL.
Parameters:
location - the URL for the image
See Also:
ImageIcon.ImageIcon


TileIcon

public TileIcon(URL location, String description)
Creates a TileIcon from the specified URL.
Parameters:
location - the URL for the image
description - a brief textual description of the image
See Also:
ImageIcon.ImageIcon


 
Method Detail

getIconHeight

@Override
public int getIconHeight()
Overridden to return 0. The size of this Icon is determined by the size of the component.
Returns:
0


getIconWidth

@Override
public int getIconWidth()
Overridden to return 0. The size of this Icon is determined by the size of the component.
Returns:
0


getTileMode

public TileIcon.TileMode getTileMode()
Returns the tiling mode of this TileIcon
Returns:
the TileMode of this Icon: DEFAULT, CENTER_CENTER or CENTER_CORNER


paintIcon

@Override
public void paintIcon(Component c, Graphics g, int x, int y)
Paints the icon. The image is tiled over the area of the component to which it is painted.

If this icon has no image observer,this method uses the c component as the observer.

Parameters:
c - the component to which the Icon is painted. This is used as the observer if this icon has no image observer
g - the graphics context
x - not used.
y - not used.
See Also:
ImageIcon.paintIcon


setTileMode

public void setTileMode(TileIcon.TileMode tileMode)
Sets the tiling mode. If not explicitly set or if set to TileMode.DEFAULT, the image will be tiled starting from the top left corner of the component.
Parameters:
tileMode - the tiling style. One of the following constants defined in enum TileMode:
  • DEFAULT
  • CENTER_CENTER
  • CENTER_CORNER
See Also:
TileMode


valueOf

TileIcon valueOf(String name)
Returns the enum constant of this type with the specified name.


values

TileIcon[] values()
Returns an array containing the constants of this enum type, in the order they are declared.


 

Groovy Documentation