All Packages Class Hierarchy This Package Previous Next Index
Class com.wildcrest.MultiLineLabel
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Canvas
|
+----com.wildcrest.MultiLineLabel
- public class MultiLineLabel
- extends Canvas
(C) Copyright 1999, Wildcrest Associates (http://www.wildcrest.com).
All rights reserved.
A Java component for displaying multiple line read-only text label.
Supports line breaks, line spacing, tab expansion,
margins (left, right, top, bottom), line wrap (disabled in free version),
font selection, height autosizing, and a multiple line property sheet editor.
-
MultiLineLabel()
- Construct a MultiLineLabel object with an empty label and default width
-
MultiLineLabel(String)
- Construct a MultiLineLabel object with the specified string as the label
-
MultiLineLabel(String, int)
- Construct a MultiLineLabel object with the specified string as the label
and with initial width in pixels
-
addPropertyChangeListener(PropertyChangeListener)
-
-
getBottomMargin()
- Returns the bottom margin of the label.
-
getCopyright()
-
-
getInchesPerTab()
- Returns the inches per tab stop for the label.
-
getLabelWidth()
- Returns the width of the component.
-
getLeftMargin()
- Returns the left margin of the label.
-
getLineSpacing()
- Returns the line spacing for the label.
-
getMinimumSize()
- Returns the minimum size for displaying this component.
-
getPreferredSize()
- Returns the recommended size for displaying this component.
-
getRightMargin()
- Returns the right margin of the label.
-
getText()
- Returns the label's text string.
-
getTopMargin()
- Returns the top margin of the label.
-
getWrap()
- Returns whether automatic line wrapping is enabled or disabled.
-
minimumSize()
-
Deprecated.
-
paint(Graphics)
- Paints the MultiLineLabel component using the given graphics context (called by AWT)
-
preferredSize()
-
Deprecated.
-
removePropertyChangeListener(PropertyChangeListener)
-
-
setBottomMargin(double)
- Sets the bottom margin in inches.
-
setBounds(int, int, int, int)
- Moves and resizes this component.
-
setCopyright(String)
-
-
setInchesPerTab(double)
- Sets the inches per tab stop.
-
setLabelWidth(int)
- Sets width of the label.
-
setLeftMargin(double)
- Sets the left margin in inches.
-
setLineSpacing(double)
- Sets the line spacing, in multiples of fontHeight.
-
setLocation(int, int)
- Set location for this component.
-
setRightMargin(double)
- Sets the right margin in inches.
-
setSize(int, int)
- Resizes this component.
-
setText(String)
- Sets the text label.
-
setTopMargin(double)
- Sets the top margin in inches.
-
setWrap(boolean)
- Sets whether automatic line wrap is enabled or disabled.
MultiLineLabel
public MultiLineLabel(String string,
int width)
- Construct a MultiLineLabel object with the specified string as the label
and with initial width in pixels
MultiLineLabel
public MultiLineLabel(String string)
- Construct a MultiLineLabel object with the specified string as the label
MultiLineLabel
public MultiLineLabel()
- Construct a MultiLineLabel object with an empty label and default width
setText
public void setText(String str)
- Sets the text label. Can have embedded line.separators to indicate hard line boundaries
or can rely on line wrapping feature to break lines. Also can have embedded tabs.
- Parameters:
- string - a string specifying the text of the MultiLineLabel,
which may (or may not) have embedded line.separators and tabs
getText
public synchronized String getText()
- Returns the label's text string.
setInchesPerTab
public void setInchesPerTab(double inchesPerTab)
- Sets the inches per tab stop.
- Parameters:
- inchesPerTab - inches per tab stop. Default: 0.5
getInchesPerTab
public synchronized double getInchesPerTab()
- Returns the inches per tab stop for the label.
setLineSpacing
public void setLineSpacing(double lineSpacing)
- Sets the line spacing, in multiples of fontHeight.
- Parameters:
- lineSpacing - in multiples of fontHeight (1.0 = single spacing,
2.0 = double spacing, etc.) Default: 1.0
getLineSpacing
public synchronized double getLineSpacing()
- Returns the line spacing for the label.
setLeftMargin
public void setLeftMargin(double leftMargin)
- Sets the left margin in inches.
- Parameters:
- leftMargin - left margin in inches. Default: 0.0
getLeftMargin
public synchronized double getLeftMargin()
- Returns the left margin of the label.
setRightMargin
public void setRightMargin(double rightMargin)
- Sets the right margin in inches.
- Parameters:
- rightMargin - right margin in inches (negative values allowed). Default: 0.0
getRightMargin
public synchronized double getRightMargin()
- Returns the right margin of the label.
setTopMargin
public void setTopMargin(double topMargin)
- Sets the top margin in inches.
- Parameters:
- topMargin - top margin in inches. Default: 0.0
getTopMargin
public synchronized double getTopMargin()
- Returns the top margin of the label.
setBottomMargin
public void setBottomMargin(double bottomMargin)
- Sets the bottom margin in inches.
- Parameters:
- bottomMargin - bottom margin in inches (negative values allowed). Default 0.0
getBottomMargin
public synchronized double getBottomMargin()
- Returns the bottom margin of the label.
setWrap
public void setWrap(boolean wrap)
- Sets whether automatic line wrap is enabled or disabled.
- Parameters:
- wrap - whether automatic line wrap is enabled or disabled. Default: true
(disabled regardless of setting in free version)
getWrap
public synchronized boolean getWrap()
- Returns whether automatic line wrapping is enabled or disabled.
setLabelWidth
public void setLabelWidth(int width)
- Sets width of the label.
- Parameters:
- width - width of the label in pixels. Default: 150
getLabelWidth
public synchronized int getLabelWidth()
- Returns the width of the component.
setCopyright
public void setCopyright(String str)
getCopyright
public synchronized String getCopyright()
addPropertyChangeListener
public void addPropertyChangeListener(PropertyChangeListener listener)
removePropertyChangeListener
public void removePropertyChangeListener(PropertyChangeListener listener)
paint
public void paint(Graphics g)
- Paints the MultiLineLabel component using the given graphics context (called by AWT)
- Parameters:
- g - the graphics context used for painting the component
- Overrides:
- paint in class Canvas
getPreferredSize
public Dimension getPreferredSize()
- Returns the recommended size for displaying this component.
Width is left unchanged, height is the size needed to display
all the lines of text.
- Overrides:
- getPreferredSize in class Component
- See Also:
- getMinimumSize
preferredSize
public Dimension preferredSize()
- Note: preferredSize() is deprecated.
- Overrides:
- preferredSize in class Component
- See Also:
- getPreferredSize
getMinimumSize
public Dimension getMinimumSize()
- Returns the minimum size for displaying this component.
Width is left unchange, height is the size needed to display
all the lines of text.
- Overrides:
- getMinimumSize in class Component
- See Also:
- getPreferredSize
minimumSize
public Dimension minimumSize()
- Note: minimumSize() is deprecated.
- Overrides:
- minimumSize in class Component
- See Also:
- getMinimumSize
setBounds
public synchronized void setBounds(int x,
int y,
int width,
int height)
- Moves and resizes this component. Causes rewrap of text.
- Parameters:
- x - horizontal position in parent container's coordinates
- y - vertical position in parent container's coordinates
- width - desired width in pixels
- height - desired height in pixels
- Overrides:
- setBounds in class Component
setSize
public synchronized void setSize(int width,
int height)
- Resizes this component. Causes rewrap of text.
- Parameters:
- width - desired width in pixels
- height - desired height in pixels
- Overrides:
- setSize in class Component
setLocation
public synchronized void setLocation(int x,
int y)
- Set location for this component. Causes rewrap of text.
- Parameters:
- x - desired x coordinate
- y - desired y coordinate
- Overrides:
- setLocation in class Component
All Packages Class Hierarchy This Package Previous Next Index