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

Variable Index

 o DEFAULT_LENGTH
Default caption length (50).

Constructor Index

 o Caption()
Constructs a caption with a blank label.
 o Caption(String)
Constructs a caption with the specified label and default length.

Method Index

 o getLabel()
Returns the current label.
 o getLength()
Returns the current length of the caption.
 o getSize()
Method required by Paintable interface but not really used.
 o isResizable()
Returns true if this caption is resizable.
 o isSelected()
Returns whether this caption is currently selected.
 o isVisible()
Returns whether the caption is currently being shown or not.
 o paint(Graphics)
Paints the caption.
 o paintBackground(Graphics)
Paints the background of the caption.
 o setLabel(Object)
Sets the label displayed on the caption.
 o setLength(int)
Sets the length of the caption.
 o setResizable(boolean)
Sets whether this caption is resizable.
 o setSelected(boolean)
Selects or deselected this caption.
 o setVisible(boolean)
Shows or hides the caption.
 o toString()
Returns a string representation of this Caption.

Variables

 o DEFAULT_LENGTH
 public static final int DEFAULT_LENGTH
Default caption length (50).

Constructors

 o Caption
 public Caption()
Constructs a caption with a blank label.

 o 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

Methods

 o setLabel
 public void setLabel(Object label)
Sets the label displayed on the caption.

Parameters:
label - The new label.
See Also:
getLabel
 o getLabel
 public Object getLabel()
Returns the current label.

See Also:
setLabel
 o 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
 o getLength
 public int getLength()
Returns the current length of the caption.

See Also:
DEFAULT_LENGTH, setLength
 o 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
 o isResizable
 public boolean isResizable()
Returns true if this caption is resizable.

See Also:
setResizable
 o 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
 o isVisible
 public boolean isVisible()
Returns whether the caption is currently being shown or not.

See Also:
setVisible
 o 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
 o isSelected
 public boolean isSelected()
Returns whether this caption is currently selected.

See Also:
setSelected
 o getSize
 public Dimension getSize()
Method required by Paintable interface but not really used.

 o 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.

 o 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.

 o 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