Class com.symantec.itools.swing.JWrappingLabel
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.symantec.itools.swing.JWrappingLabel

Object
   |
   +----Component
           |
           +----Container
                   |
                   +----JComponent
                           |
                           +----com.symantec.itools.swing.JWrappingLabel

public class JWrappingLabel
extends JComponent
implements SwingConstants
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.


Variable Index

 o align
The current text alignment.
 o text
The text string being displayed.

Constructor Index

 o com.symantec.itools.swing.JWrappingLabel()
Constructs a default wrapping label.
 o com.symantec.itools.swing.JWrappingLabel(String)
Constructs a wrapping label that displays the specified string.
 o com.symantec.itools.swing.JWrappingLabel(String, int)
Constructs wrapping label with the specified text and alignment.

Method Index

 o addPropertyChangeListener(PropertyChangeListener)
Adds a listener for all event changes.
 o addVetoableChangeListener(VetoableChangeListener)
Adds a vetoable listener for all event changes.
 o drawAlignedString(Graphics, FontMetrics, int, String, int, int, int)
This helper method draws a string aligned the requested way.
 o getText()
Gets the current label text.
 o getTextAlignment()
Gets the current text alignment setting.
 o paintComponent(Graphics)
Paints this component using the given graphics context.
 o paramString()
Returns an empty string.
 o removePropertyChangeListener(PropertyChangeListener)
Removes a listener for all event changes.
 o removeVetoableChangeListener(VetoableChangeListener)
Removes a vetoable listener for all event changes.
 o setText(String)
Sets the label text.
 o setTextAlignment(int)
Sets the text alignment.

Variables

 o align
protected int align
The current text alignment. One of ALIGN_LEFT, ALIGN_CENTERED, or ALIGN_RIGHT.

See Also:
LEFT, CENTER, RIGHT
 o text
protected java.lang.String text
The text string being displayed.

Constructors

 o JWrappingLabel
public JWrappingLabel()
Constructs a default wrapping label. Default values are an empty text string and left alignment.

 o JWrappingLabel
public JWrappingLabel(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
 o JWrappingLabel
public JWrappingLabel(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:
Alignment, ALIGN_LEFT, ALIGN_CENTERED, ALIGN_RIGHT

Methods

 o addPropertyChangeListener
public synchronized void addPropertyChangeListener(PropertyChangeListener listener)
Adds a listener for all event changes.

Parameters:
PropertyChangeListener - listener the listener to add.
Overrides:
addPropertyChangeListener in class JComponent
See Also:
removePropertyChangeListener
 o addVetoableChangeListener
public synchronized void addVetoableChangeListener(VetoableChangeListener listener)
Adds a vetoable listener for all event changes.

Parameters:
VetoableChangeListener - listener the listener to add.
Overrides:
addVetoableChangeListener in class JComponent
See Also:
removeVetoableChangeListener
 o drawAlignedString
protected void drawAlignedString(Graphics g,
                                 FontMetrics fm,
                                 int baseline,
                                 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
 o getText
public java.lang.String getText()
Gets the current label text.

Returns:
the label's text string
See Also:
setText
 o getTextAlignment
public int getTextAlignment()
Gets the current text alignment setting.

Returns:
the current alignment, one of ALIGN_LEFT, ALIGN_CENTERED, or ALIGN_RIGHT
See Also:
setTextAlignment, Alignment, ALIGN_LEFT, ALIGN_CENTERED, ALIGN_RIGHT
 o paintComponent
public void paintComponent(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:
paintComponent in class JComponent
See Also:
repaint, update
 o 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 Container
 o removePropertyChangeListener
public synchronized void removePropertyChangeListener(PropertyChangeListener listener)
Removes a listener for all event changes.

Parameters:
PropertyChangeListener - listener the listener to remove.
Overrides:
removePropertyChangeListener in class JComponent
See Also:
addPropertyChangeListener
 o removeVetoableChangeListener
public synchronized void removeVetoableChangeListener(VetoableChangeListener listener)
Removes a vetoable listener for all event changes.

Parameters:
VetoableChangeListener - listener the listener to remove.
Overrides:
removeVetoableChangeListener in class JComponent
See Also:
addVetoableChangeListener
 o 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
 o setTextAlignment
public void setTextAlignment(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:
getTextAlignment, Alignment, ALIGN_LEFT, ALIGN_CENTERED, ALIGN_RIGHT

All Packages  Class Hierarchy  This Package  Previous  Next  Index