All Packages Class Hierarchy This Package Previous Next Index
Class COM.taligent.widget.Caption
java.lang.Object
|
+----COM.taligent.widget.Caption
- public class Caption
- extends Object
- implements Serializable, Paintable
A simple class that encapsulates a caption used within
CaptionBar. To keep it lightweight, each caption is no
longer a separate component. It is now merely a Paintable
object that knows how to draw itself.
- Version:
- 2.0
- Author:
- Andy Clark, Taligent Inc.
- See Also:
- CaptionBar
-
DEFAULT_LENGTH
- Default caption length (50).
-
Caption()
- Constructs a caption with a blank label.
-
Caption(String)
- Constructs a caption with the specified label and
default length.
-
getLabel()
- Returns the current label.
-
getLength()
- Returns the current length of the caption.
-
getSize()
- Method required by Paintable interface but not really
used.
-
isResizable()
- Returns true if this caption is resizable.
-
isSelected()
- Returns whether this caption is currently selected.
-
isVisible()
- Returns whether the caption is currently being shown
or not.
-
paint(Graphics)
- Paints the caption.
-
paintBackground(Graphics)
- Paints the background of the caption.
-
setLabel(Object)
- Sets the label displayed on the caption.
-
setLength(int)
- Sets the length of the caption.
-
setResizable(boolean)
- Sets whether this caption is resizable.
-
setSelected(boolean)
- Selects or deselected this caption.
-
setVisible(boolean)
- Shows or hides the caption.
-
toString()
- Returns a string representation of this Caption.
DEFAULT_LENGTH
public static final int DEFAULT_LENGTH
- Default caption length (50).
Caption
public Caption()
- Constructs a caption with a blank label.
Caption
public Caption(String label)
- Constructs a caption with the specified label and
default length.
- Parameters:
- label - The text string to display on the caption.
- See Also:
- DEFAULT_LENGTH
setLabel
public void setLabel(Object label)
- Sets the label displayed on the caption.
- Parameters:
- label - The new label.
- See Also:
- getLabel
getLabel
public Object getLabel()
- Returns the current label.
- See Also:
- setLabel
setLength
public void setLength(int length)
- Sets the length of the caption. If an invalid length
is specified, then the length will be set to the
default length.
- Parameters:
- length - The new length.
- See Also:
- DEFAULT_LENGTH, getLength
getLength
public int getLength()
- Returns the current length of the caption.
- See Also:
- DEFAULT_LENGTH, setLength
setResizable
public void setResizable(boolean resizable)
- Sets whether this caption is resizable.
- Parameters:
- resizable - Is true if caption is resizable; false if not.
- See Also:
- isResizable
isResizable
public boolean isResizable()
- Returns true if this caption is resizable.
- See Also:
- setResizable
setVisible
public void setVisible(boolean visible)
- Shows or hides the caption. The Component that contains this
caption is responsible for repainting the display.
- Parameters:
- visible - True to show, false to hide.
- See Also:
- isVisible
isVisible
public boolean isVisible()
- Returns whether the caption is currently being shown
or not.
- See Also:
- setVisible
setSelected
public void setSelected(boolean selected)
- Selects or deselected this caption. This changes the
appearance of caption -- by default, shows the label in
a BOLD font.
- Parameters:
- selected - True if selected, false if not selected.
- See Also:
- isSelected
isSelected
public boolean isSelected()
- Returns whether this caption is currently selected.
- See Also:
- setSelected
getSize
public Dimension getSize()
- Method required by Paintable interface but not really
used.
paint
public synchronized void paint(Graphics g)
- Paints the caption.
When extending this class, always use Graphics.getClipBounds()
to determine your drawing location and size. If you change the
clipping rectangle, make sure that you reset it before returning
from this method.
paintBackground
public void paintBackground(Graphics g)
- Paints the background of the caption. This method is used by
the CaptionBar to paint unused portions of the bar.
When extending this class, always use Graphics.getClipBounds()
to determine your drawing location and size. If you change the
clipping rectangle, make sure that you reset it before returning
from this method.
toString
public String toString()
- Returns a string representation of this Caption.
- Overrides:
- toString in class Object
All Packages Class Hierarchy This Package Previous Next Index