|
Groovy Documentation | |||||||
| FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectjavax.swing.ImageIcon
com.wordpress.tipsforjava.swing.StretchIcon
public class StretchIcon extends ImageIcon
@(#)StretchIcon.java 1.0 03/27/12
| Field Summary | |
|---|---|
protected boolean |
proportionate
Determines whether the aspect ratio of the image is maintained. |
| Constructor Summary | |
StretchIcon(byte[] imageData)
Creates a |
|
StretchIcon(byte[] imageData, boolean proportionate)
Creates a |
|
StretchIcon(byte[] imageData, String description)
Creates a |
|
StretchIcon(byte[] imageData, String description, boolean proportionate)
Creates a |
|
StretchIcon(Image image)
Creates a StretchIcon from the image. |
|
StretchIcon(Image image, boolean proportionate)
Creates a StretchIcon from the image with the specifiec behavior. |
|
StretchIcon(Image image, String description)
Creates a StretchIcon from the image. |
|
StretchIcon(Image image, String description, boolean proportionate)
Creates a StretchIcon from the image with the specified behavior. |
|
StretchIcon(String filename)
Creates a StretchIcon from the specified file. |
|
StretchIcon(String filename, boolean proportionate)
Creates a StretchIcon from the specified file with the specified behavior. |
|
StretchIcon(String filename, String description)
Creates a StretchIcon from the specified file. |
|
StretchIcon(String filename, String description, boolean proportionate)
Creates a StretchIcon from the specified file with the specified behavior. |
|
StretchIcon(URL location)
Creates a StretchIcon from the specified URL. |
|
StretchIcon(URL location, boolean proportionate)
Creates a StretchIcon from the specified URL with the specified behavior. |
|
StretchIcon(URL location, String description)
Creates a StretchIcon from the specified URL. |
|
StretchIcon(URL location, String description, boolean proportionate)
Creates a StretchIcon from the specified URL with the specified behavior. |
|
| Method Summary | |
|---|---|
int
|
getIconHeight()
Overridden to return 0. |
int
|
getIconWidth()
Overridden to return 0. |
void
|
paintIcon(Component c, Graphics g, int x, int y)
Paints the icon. |
| 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 |
|---|
protected boolean proportionate
false to distort the image to fill the component.
| Constructor Detail |
|---|
public StretchIcon(byte[] imageData)
StretchIcon from an array of bytes.
imageData - an array of pixels in an image format supported by
the AWT Toolkit, such as GIF, JPEG, or (as of 1.3) PNG
public StretchIcon(byte[] imageData, boolean proportionate)
StretchIcon from an array of bytes with the specified behavior.
imageData - an array of pixels in an image format supported by
the AWT Toolkit, such as GIF, JPEG, or (as of 1.3) PNGproportionate - true to retain the image's aspect ratio,
false to allow distortion of the image to fill the
component.
public StretchIcon(byte[] imageData, String description)
StretchIcon from an array of bytes.
imageData - an array of pixels in an image format supported by
the AWT Toolkit, such as GIF, JPEG, or (as of 1.3) PNGdescription - a brief textual description of the image
public StretchIcon(byte[] imageData, String description, boolean proportionate)
StretchIcon from an array of bytes with the specified behavior.
imageData - an array of pixels in an image format supported by
the AWT Toolkit, such as GIF, JPEG, or (as of 1.3) PNGdescription - a brief textual description of the imageproportionate - true to retain the image's aspect ratio,
false to allow distortion of the image to fill the
component.
public StretchIcon(Image image)
image - the image
public StretchIcon(Image image, boolean proportionate)
image - the imageproportionate - true to retain the image's aspect ratio,
false to allow distortion of the image to fill the
component.
public StretchIcon(Image image, String description)
image - the imagedescription - a brief textual description of the image
public StretchIcon(Image image, String description, boolean proportionate)
image - the imagedescription - a brief textual description of the imageproportionate - true to retain the image's aspect ratio,
false to allow distortion of the image to fill the
component.
public StretchIcon(String filename)
filename - a String specifying a filename or path
public StretchIcon(String filename, boolean proportionate)
filename - a String specifying a filename or pathproportionate - true to retain the image's aspect ratio,
false to allow distortion of the image to fill the
component.
public StretchIcon(String filename, String description)
filename - a String specifying a filename or pathdescription - a brief textual description of the image
public StretchIcon(String filename, String description, boolean proportionate)
filename - a String specifying a filename or pathdescription - a brief textual description of the imageproportionate - true to retain the image's aspect ratio,
false to allow distortion of the image to fill the
component.
public StretchIcon(URL location)
location - the URL for the image
public StretchIcon(URL location, boolean proportionate)
location - the URL for the imageproportionate - true to retain the image's aspect ratio,
false to allow distortion of the image to fill the
component.
public StretchIcon(URL location, String description)
location - the URL for the imagedescription - a brief textual description of the image
public StretchIcon(URL location, String description, boolean proportionate)
location - the URL for the imagedescription - a brief textual description of the imageproportionate - true to retain the image's aspect ratio,
false to allow distortion of the image to fill the
component.
| Method Detail |
|---|
@Override public int getIconHeight()
@Override public int getIconWidth()
@Override public void paintIcon(Component c, Graphics g, int x, int y)
If the proportion has not been specified, or has been specified as true,
the aspect ratio of the image will be preserved by padding and centering the image
horizontally or vertically. Otherwise the image may be distorted to fill the
component it is painted to.
If this icon has no image observer,this method uses the c component
as the observer.
c - the component to which the Icon is painted. This is used as the
observer if this icon has no image observerg - the graphics contextx - not used.y - not used.
Groovy Documentation