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 NameProperty TypeDescription
LabelString text label.
ImageImage Label image.

See Also:
Label

Variable Index

 o CENTER
Align the text to the center.
 o LEFT
Align the text to the left.
 o RIGHT
Align the text to the right.

Constructor Index

 o ImageLabel()
Construct an empty ImageLabel.
 o ImageLabel(Image, String)
Construct an ImageLabel with specified image and text.

Method Index

 o getAlignment()
Get the alignment property.
 o getColumns()
Get the number of columns of this image label.
 o getImage()
Get the image of the image label.
 o getImageAlignment()
Get the image alignment property.
 o getMinimumSize()
Calculate the minimum size of the image label.
 o getPreferredSize()
Calculate the preferred size of the image label.
 o getText()
Get the text of the image label.
 o paint(Graphics)
Paint the current text.
 o setAlignment(int)
Set the alignment of the text.
 o setColumns(int)
Set the number of text columns in the image label.
 o setImage(Image)
Set the image icon for this image label.
 o setImageAlignment(int)
Set the alignment of the image.
 o setText(String)
Set the text of the image label.

Variables

 o LEFT
 public static final int LEFT
Align the text to the left.

 o CENTER
 public static final int CENTER
Align the text to the center.

 o RIGHT
 public static final int RIGHT
Align the text to the right.

Constructors

 o ImageLabel
 public ImageLabel()
Construct an empty ImageLabel.

 o ImageLabel
 public ImageLabel(Image image,
                   String label)
Construct an ImageLabel with specified image and text.

Parameters:
image - label image.
label - label text.

Methods

 o setColumns
 public synchronized void setColumns(int cols)
Set the number of text columns in the image label.

Parameters:
cols - number of columns.
 o getColumns
 public int getColumns()
Get the number of columns of this image label.

 o setText
 public synchronized void setText(String text)
Set the text of the image label.

Parameters:
text - text string.
 o getText
 public String getText()
Get the text of the image label.

Returns:
text string.
 o setAlignment
 public synchronized void setAlignment(int align)
Set the alignment of the text.

Parameters:
align - alignment flag.
 o getAlignment
 public int getAlignment()
Get the alignment property.

Returns:
alignment flag.
 o setImage
 public synchronized void setImage(Image image)
Set the image icon for this image label.

Parameters:
image - image icon.
 o getImage
 public Image getImage()
Get the image of the image label.

Returns:
image icon.
 o setImageAlignment
 public synchronized void setImageAlignment(int align)
Set the alignment of the image.

Parameters:
align - alignment flag.
 o getImageAlignment
 public int getImageAlignment()
Get the image alignment property.

Returns:
alignment flag.
 o getPreferredSize
 public Dimension getPreferredSize()
Calculate the preferred size of the image label.

Returns:
preferred size.
Overrides:
getPreferredSize in class Component
 o getMinimumSize
 public Dimension getMinimumSize()
Calculate the minimum size of the image label.

Returns:
minimum size.
Overrides:
getMinimumSize in class Component
 o paint
 public void paint(Graphics g)
Paint the current text.

Overrides:
paint in class Canvas

All Packages  Class Hierarchy  This Package  Previous  Next  Index