|
Groovy Documentation | |||||||
| FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectjavax.swing.ImageIcon
com.wordpress.tipsforjava.swing.StretchIcon
com.wordpress.tipsforjava.swing.ShrinkIcon
com.wordpress.tipsforjava.swing.ThumbnailIcon
public class ThumbnailIcon extends ShrinkIcon
@(#)ThumbnailIcon.java 1.0 04/12/12
| Field Summary | |
|---|---|
static int |
COMPUTED
The constant for setting the width, height, default width or default height to be computed from the other dimension in a way that maintains the aspect ratio of the contained image. |
static int |
DEFAULT
The constant for setting the width and/or height to use the default for the class. |
private static int |
defaultHeight
|
private static int |
defaultWidth
|
private int |
thumbHeight
|
private int |
thumbWidth
|
| Fields inherited from class StretchIcon | |
|---|---|
| proportionate |
| Constructor Summary | |
ThumbnailIcon(byte[] imageData)
Creates a |
|
ThumbnailIcon(byte[] imageData, String description)
Creates a |
|
ThumbnailIcon(Image image)
Creates a |
|
ThumbnailIcon(Image image, String description)
Creates a |
|
ThumbnailIcon(String filename)
Creates a |
|
ThumbnailIcon(String filename, String description)
Creates a |
|
ThumbnailIcon(URL location)
Creates a |
|
ThumbnailIcon(URL location, String description)
Creates a |
|
| Method Summary | |
|---|---|
static int
|
getDefaultHeight()
Gets the default height of all |
static int
|
getDefaultWidth()
Gets the default width of all |
int
|
getIconHeight()
Gets the height of the icon. |
int
|
getIconWidth()
Gets the width of the icon. |
int
|
getThumbHeight()
Returns the height that has been set, or |
int
|
getThumbWidth()
Returns the width that has been set, or |
BufferedImage
|
getThumbnail()
Convenience method to obtain the icon's image at the size at which it is displayed. |
static void
|
setDefaultSize(int width, int height)
Sets the default size of all |
void
|
setThumbHeight(int height)
Sets the height of an individual |
void
|
setThumbWidth(int width)
Sets the width of an individual |
| Methods inherited from class ShrinkIcon | |
|---|---|
| paintIcon |
| Methods inherited from class StretchIcon | |
|---|---|
| getIconHeight, getIconWidth, paintIcon |
| 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 |
| Field Detail |
|---|
public static final int COMPUTED
If both the width and height evaluate to COMPUTED, the image
will be displayed at its natural size, essentially mimicking the behavior
of ImageIcon.
public static final int DEFAULT
private static int defaultHeight
private static int defaultWidth
private int thumbHeight
private int thumbWidth
| Constructor Detail |
|---|
public ThumbnailIcon(byte[] imageData)
ThumbnailIcon 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 ThumbnailIcon(byte[] imageData, String description)
ThumbnailIcon 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 ThumbnailIcon(Image image)
ThumbnailIcon from the image.
image - the image
public ThumbnailIcon(Image image, String description)
ThumbnailIcon from the image.
image - the imagedescription - a brief textual description of the image
public ThumbnailIcon(String filename)
ThumbnailIcon from the specified file.
filename - a String specifying a filename or path
public ThumbnailIcon(String filename, String description)
ThumbnailIcon from the specified file.
filename - a String specifying a filename or pathdescription - a brief textual description of the image
public ThumbnailIcon(URL location)
ThumbnailIcon from the specified URL.
location - the URL for the image
public ThumbnailIcon(URL location, String description)
ThumbnailIcon from the specified URL.
location - the URL for the imagedescription - a brief textual description of the image
| Method Detail |
|---|
public static int getDefaultHeight()
ThumbnailIcons. A return value
of zero indicates that the default height will be computed from the default
width so as to maintain the aspect ratio of the contained image.
ThumbnailIcons
public static int getDefaultWidth()
ThumbnailIcons. A return value
of zero indicates that the default width will be computed from the default
height so as to maintain the aspect ratio of the contained image.
ThumbnailIcons
@Override public int getIconHeight()
@Override public int getIconWidth()
public int getThumbHeight()
DEFAULT. Note that this
is not the same value as that returned by getIconHeight().
DEFAULT if none has been set.
public int getThumbWidth()
DEFAULT. Note that this
is not the same value as that returned by getIconWidth().
DEFAULT if none has been set.
public BufferedImage getThumbnail()
public static void setDefaultSize(int width, int height)
ThumbnailIcons.
If either the width or height is zero it will be computed from the other
dimension, according to the aspect ratio of each ThumbnaiIcon's
contained image. Setting the default width to zero may be useful for a horizontal
layout of components that display a ThumbnailIcon; correspondingly,
a default height of zero can be useful in a vertical layout.
If both width and height are zero, a ThumbnailIcon that respects the
default width and height will be sized to its contained image, essentially
mimicking the behavior of ImageIcon.
width - The default width to set.height - The default height to set.
public void setThumbHeight(int height)
ThumbnailIcon.
Set the height to DEFAULT to use the default height for the class,
or set it to COMPUTED for the height to be computed form the width,
maintaining the aspect ratio of the contained image.
If both the width and height evaluate to COMPUTED, the image
will be displayed at its natural size, essentially mimicking the behavior
of ImageIcon.
Setting a value less than DEFAULT is not permitted.
height - The height to set
public void setThumbWidth(int width)
ThumbnailIcon.
Set the width to DEFAULT to use the default width for the class,
or set it to COMPUTED for the width to be computed form the height,
maintaining the aspect ratio of the contained image.
If both the width and height evaluate to COMPUTED, the image
will be displayed at its natural size, essentially mimicking the behavior
of ImageIcon.
Setting a value less than DEFAULT is not permitted.
width - The width to set
Groovy Documentation