All Packages Class Hierarchy This Package Previous Next Index
Class tea.set.ImageLabel
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Canvas
|
+----tea.set.ImageLabel
- public class ImageLabel
- extends Canvas
ImageLabel is an enhanced version of the AWT.Label class. In addition
to a text label, an image can be displayed together at the lefthand
side of the label. The image is always scaled to the width and height
equal to the height of the widget. The label itself does
not provide any border. Use Effect3D to add a border if one is
desired.
Example:
text = new ImageLabel(getImage(url), label);
add(new Effect3D(text, Effect3D.LOWERED), "North");
ImageLabel supports the following properties:
Property Name | Property Type | Description |
Label | String |
text label. |
Image | Image |
Label image. |
- See Also:
- Label
-
CENTER
- Align the text to the center.
-
LEFT
- Align the text to the left.
-
RIGHT
- Align the text to the right.
-
ImageLabel()
- Construct an empty ImageLabel.
-
ImageLabel(Image, String)
- Construct an ImageLabel with specified image and text.
-
getAlignment()
- Get the alignment property.
-
getColumns()
- Get the number of columns of this image label.
-
getImage()
- Get the image of the image label.
-
getImageAlignment()
- Get the image alignment property.
-
getMinimumSize()
- Calculate the minimum size of the image label.
-
getPreferredSize()
- Calculate the preferred size of the image label.
-
getText()
- Get the text of the image label.
-
paint(Graphics)
- Paint the current text.
-
setAlignment(int)
- Set the alignment of the text.
-
setColumns(int)
- Set the number of text columns in the image label.
-
setImage(Image)
- Set the image icon for this image label.
-
setImageAlignment(int)
- Set the alignment of the image.
-
setText(String)
- Set the text of the image label.
LEFT
public static final int LEFT
- Align the text to the left.
CENTER
public static final int CENTER
- Align the text to the center.
RIGHT
public static final int RIGHT
- Align the text to the right.
ImageLabel
public ImageLabel()
- Construct an empty ImageLabel.
ImageLabel
public ImageLabel(Image image,
String label)
- Construct an ImageLabel with specified image and text.
- Parameters:
- image - label image.
- label - label text.
setColumns
public synchronized void setColumns(int cols)
- Set the number of text columns in the image label.
- Parameters:
- cols - number of columns.
getColumns
public int getColumns()
- Get the number of columns of this image label.
setText
public synchronized void setText(String text)
- Set the text of the image label.
- Parameters:
- text - text string.
getText
public String getText()
- Get the text of the image label.
- Returns:
- text string.
setAlignment
public synchronized void setAlignment(int align)
- Set the alignment of the text.
- Parameters:
- align - alignment flag.
getAlignment
public int getAlignment()
- Get the alignment property.
- Returns:
- alignment flag.
setImage
public synchronized void setImage(Image image)
- Set the image icon for this image label.
- Parameters:
- image - image icon.
getImage
public Image getImage()
- Get the image of the image label.
- Returns:
- image icon.
setImageAlignment
public synchronized void setImageAlignment(int align)
- Set the alignment of the image.
- Parameters:
- align - alignment flag.
getImageAlignment
public int getImageAlignment()
- Get the image alignment property.
- Returns:
- alignment flag.
getPreferredSize
public Dimension getPreferredSize()
- Calculate the preferred size of the image label.
- Returns:
- preferred size.
- Overrides:
- getPreferredSize in class Component
getMinimumSize
public Dimension getMinimumSize()
- Calculate the minimum size of the image label.
- Returns:
- minimum size.
- Overrides:
- getMinimumSize in class Component
paint
public void paint(Graphics g)
- Paint the current text.
- Overrides:
- paint in class Canvas
All Packages Class Hierarchy This Package Previous Next Index