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.
-
align
- The current text alignment.
-
text
- The text string being displayed.
-
com.symantec.itools.swing.JWrappingLabel()
- Constructs a default wrapping label.
-
com.symantec.itools.swing.JWrappingLabel(String)
- Constructs a wrapping label that displays the specified string.
-
com.symantec.itools.swing.JWrappingLabel(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, FontMetrics, int, String, int, int, int)
- This helper method draws a string aligned the requested way.
-
getText()
- Gets the current label text.
-
getTextAlignment()
- Gets the current text alignment setting.
-
paintComponent(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.
-
setText(String)
- Sets the label text.
-
setTextAlignment(int)
- Sets the text alignment.
align
protected int align
- The current text alignment.
One of ALIGN_LEFT, ALIGN_CENTERED, or ALIGN_RIGHT.
- See Also:
- LEFT, CENTER, RIGHT
text
protected java.lang.String text
- The text string being displayed.
JWrappingLabel
public JWrappingLabel()
- Constructs a default wrapping label. Default values are an empty text string
and left alignment.
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
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
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
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
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
getText
public java.lang.String getText()
- Gets the current label text.
- Returns:
- the label's text string
- See Also:
- setText
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
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
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
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
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
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
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