Class symantec.itools.awt.WrappingLabel
All Packages Class Hierarchy This Package Previous Next Index
Class symantec.itools.awt.WrappingLabel
Object
|
+----Component
|
+----Canvas
|
+----symantec.itools.awt.WrappingLabel
- public class WrappingLabel
- extends Canvas
- implements AlignStyle
This class implements a multiple-line text label.
It displays text on one or more lines, wrapping text
as needed to fit in the available horizontal space.
- Version:
- 1.1, June 11, 1997
- Author:
- Symantec
-
align
- The current text alignment.
-
baseline
- The maximum ascent of the font used to display text.
-
fm
- The metrics of the font used to display text.
-
text
- The text string being displayed.
-
symantec.itools.awt.WrappingLabel()
- Constructs a default wrapping label.
-
symantec.itools.awt.WrappingLabel(String)
- Constructs a wrapping label that displays the specified string.
-
symantec.itools.awt.WrappingLabel(String, int)
- Constructs wrapping label with the specified text and alignment.
-
addPropertyChangeListener(PropertyChangeListener)
- Adds a listener for all event changes.
-
addVetoableChangeListener(VetoableChangeListener)
- Adds a vetoable listener for all event changes.
-
drawAlignedString(Graphics, String, int, int, int)
- This helper method draws a string aligned the requested way.
-
getAlignStyle()
- Gets the current text alignment setting.
-
getText()
- Gets the current label text.
-
paint(Graphics)
- Paints this component using the given graphics context.
-
paramString()
- Returns an empty string.
-
removePropertyChangeListener(PropertyChangeListener)
- Removes a listener for all event changes.
-
removeVetoableChangeListener(VetoableChangeListener)
- Removes a vetoable listener for all event changes.
-
reshape(int, int, int, int)
- Moves and/or resizes this component.
-
resize(int, int)
- Resizes this component.
-
setAlignStyle(int)
- Sets the text alignment.
-
setText(String)
- Sets the label text.
align
protected int align
- The current text alignment.
One of ALIGN_LEFT, ALIGN_CENTERED, or ALIGN_RIGHT.
- See Also:
- AlignStyle, ALIGN_LEFT, ALIGN_CENTERED, ALIGN_RIGHT
baseline
protected int baseline
- The maximum ascent of the font used to display text.
fm
protected transient java.awt.FontMetrics fm
- The metrics of the font used to display text.
text
protected java.lang.String text
- The text string being displayed.
WrappingLabel
public WrappingLabel()
- Constructs a default wrapping label. Default values are an empty text string
and left alignment.
WrappingLabel
public WrappingLabel(String s)
- Constructs a wrapping label that displays the specified string.
The label will default to left alignment.
- Parameters:
- s - string to be displayed in label
WrappingLabel
public WrappingLabel(String s,
int a)
- Constructs wrapping label with the specified text and alignment.
- Parameters:
- s - the string to be displayed in label
- a - the alignment, one of ALIGN_LEFT, ALIGN_CENTERED, or ALIGN_RIGHT
- See Also:
- AlignStyle, ALIGN_LEFT, ALIGN_CENTERED, ALIGN_RIGHT
addPropertyChangeListener
public synchronized void addPropertyChangeListener(PropertyChangeListener listener)
- Adds a listener for all event changes.
- Parameters:
- PropertyChangeListener - listener the listener to add.
- See Also:
- removePropertyChangeListener
addVetoableChangeListener
public synchronized void addVetoableChangeListener(VetoableChangeListener listener)
- Adds a vetoable listener for all event changes.
- Parameters:
- VetoableChangeListener - listener the listener to add.
- See Also:
- removeVetoableChangeListener
drawAlignedString
protected void drawAlignedString(Graphics g,
String s,
int x,
int y,
int width)
- This helper method draws a string aligned the requested way.
- Parameters:
- g - the graphics context used for painting
- s - the string to draw
- x - the point to start drawing from, x coordinate
- y - the point to start drawing from, y coordinate
- width - the width of the area to draw in, in pixels
getAlignStyle
public int getAlignStyle()
- Gets the current text alignment setting.
- Returns:
- the current alignment, one of ALIGN_LEFT, ALIGN_CENTERED, or ALIGN_RIGHT
- See Also:
- setAlignStyle, AlignStyle, ALIGN_LEFT, ALIGN_CENTERED, ALIGN_RIGHT
getText
public java.lang.String getText()
- Gets the current label text.
- Returns:
- the label's text string
- See Also:
- setText
paint
public void paint(Graphics g)
- Paints this component using the given graphics context.
This is a standard Java AWT method which typically gets called
by the AWT to handle painting this component. It paints this component
using the given graphics context. The graphics context clipping region
is set to the bounding rectangle of this component and its [0,0]
coordinate is this component's top-left corner.
- Parameters:
- g - the graphics context used for painting
- Overrides:
- paint in class Canvas
- See Also:
- repaint, update
paramString
public java.lang.String paramString()
- Returns an empty string.
This is a standard Java AWT method which typically returns a string
representing the state of this object.
- Returns:
- the empty string
- Overrides:
- paramString in class Component
removePropertyChangeListener
public synchronized void removePropertyChangeListener(PropertyChangeListener listener)
- Removes a listener for all event changes.
- Parameters:
- PropertyChangeListener - listener the listener to remove.
- See Also:
- addPropertyChangeListener
removeVetoableChangeListener
public synchronized void removeVetoableChangeListener(VetoableChangeListener listener)
- Removes a vetoable listener for all event changes.
- Parameters:
- VetoableChangeListener - listener the listener to remove.
- See Also:
- addVetoableChangeListener
reshape
public synchronized void reshape(int x,
int y,
int width,
int height)
- Moves and/or resizes this component.
This is a standard Java AWT method which gets called to move and/or
resize this component. Components that are in containers with layout
managers should not call this method, but rely on the layout manager
instead.
It is overridden here to re-wrap the text as necessary.
- Parameters:
- x - horizontal position in the parent's coordinate space
- y - vertical position in the parent's coordinate space
- width - the new width
- height - the new height
- Overrides:
- reshape in class Component
resize
public synchronized void resize(int width,
int height)
- Resizes this component.
This is a standard Java AWT method which gets called to
resize this component. Components that are in containers with layout
managers should not call this method, but rely on the layout manager
instead.
It is overridden here to re-wrap the text as necessary.
- Parameters:
- width - the new width, in pixels
- height - the new height, in pixels
- Overrides:
- resize in class Component
setAlignStyle
public void setAlignStyle(int newAlignStyle) throws PropertyVetoException
- Sets the text alignment.
- Parameters:
- newAlignStyle - the new alignment style, one of ALIGN_LEFT, ALIGN_CENTERED, or ALIGN_RIGHT
- Throws: PropertyVetoException
- if the specified property value is unacceptable
- See Also:
- getAlignStyle, AlignStyle, ALIGN_LEFT, ALIGN_CENTERED, ALIGN_RIGHT
setText
public void setText(String newText) throws PropertyVetoException
- Sets the label text.
- Parameters:
- s - the new label text
- Throws: PropertyVetoException
- if the specified property value is unacceptable
- See Also:
- getText
All Packages Class Hierarchy This Package Previous Next Index