All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.wildcrest.jmultilinelabel.JMultiLineLabel

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----javax.swing.JComponent
                           |
                           +----com.wildcrest.jmultilinelabel.JMultiLineLabel

public class JMultiLineLabel
extends JComponent
implements Accessible
(C) Copyright 1998, Wildcrest Associates (http://www.wildcrest.com). All rights reserved.

A Swing (JFC) Java component for displaying multiple line read-only text label. Supports line breaks, line spacing, tab expansion, margins (left, right, top, bottom), line wrap, font selection, height autosizing, and a multiple line property sheet editor.


Variable Index

 o labelFor
--- Accessibility Support ---

Constructor Index

 o JMultiLineLabel()
Construct a JMultiLineLabel object with an empty label and default width
 o JMultiLineLabel(String)
Construct a JMultiLineLabel object with the specified string as the label
 o JMultiLineLabel(String, int)
Construct a JMultiLineLabel object with the specified string as the label and with initial width in pixels

Method Index

 o addPropertyChangeListener(PropertyChangeListener)
 o getAccessibleContext()
Get the AccessibleContext of this object
 o getBottomInset()
Returns the bottom inset of the label.
 o getCopyright()
 o getLabelFor()
Get the component this is labelling.
 o getLabelWidth()
Returns the width of the component.
 o getLeftInset()
Returns the left inset of the label.
 o getLineSpacing()
Returns the line spacing for the label.
 o getMinimumSize()
Returns the minimum size for displaying this component.
 o getPixelsPerTab()
Returns the pixels per tab stop for the label.
 o getPreferredSize()
Returns the recommended size for displaying this component.
 o getRightInset()
Returns the right inset of the label.
 o getTabStops()
Returns the tab stop positions in pixels.
 o getText()
Returns the label's text string.
 o getTopInset()
Returns the top inset of the label.
 o getWrap()
Returns whether automatic line wrapping is enabled or disabled.
 o minimumSize()
Deprecated.
 o paint(Graphics)
Paints the JMultiLineLabel component using the given graphics context
 o preferredSize()
Deprecated.
 o removePropertyChangeListener(PropertyChangeListener)
 o setBottomInset(int)
Sets the bottom inset in pixels.
 o setBounds(int, int, int, int)
Moves and resizes this component.
 o setCopyright(String)
 o setLabelFor(Component)
Set the component this is labelling.
 o setLabelWidth(int)
Sets width of the label.
 o setLeftInset(int)
Sets the left inset in pixels.
 o setLineSpacing(double)
Sets the line spacing, in multiples of fontHeight.
 o setLocation(int, int)
Set location for this component.
 o setPixelsPerTab(int)
Sets the pixels per tab stop.
 o setRightInset(int)
Sets the right inset in pixels.
 o setSize(int, int)
Resizes this component.
 o setTabStops(int[])
Sets tab stops.
 o setText(String)
Sets the text label.
 o setTopInset(int)
Sets the top inset in pixels.
 o setWrap(boolean)
Sets whether automatic line wrap is enabled or disabled.
 o updateUI()
Notification from UIFractory that the L&F has changed, JMultiLineLabel simply reuses the JLabel look and feel elements for foreground color, background color, and font

Variables

 o labelFor
 protected Component labelFor
--- Accessibility Support ---

Constructors

 o JMultiLineLabel
 public JMultiLineLabel(String string,
                        int width)
Construct a JMultiLineLabel object with the specified string as the label and with initial width in pixels

 o JMultiLineLabel
 public JMultiLineLabel(String string)
Construct a JMultiLineLabel object with the specified string as the label

 o JMultiLineLabel
 public JMultiLineLabel()
Construct a JMultiLineLabel object with an empty label and default width

Methods

 o 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 JMultiLineLabel, which may (or may not) have embedded line.separators and tabs
 o getText
 public synchronized String getText()
Returns the label's text string.

 o setPixelsPerTab
 public void setPixelsPerTab(int pixelsPerTab)
Sets the pixels per tab stop.

Parameters:
pixelsPerTab - pixels per tab stop. Default: 40
 o getPixelsPerTab
 public synchronized int getPixelsPerTab()
Returns the pixels per tab stop for the label.

 o setTabStops
 public void setTabStops(int tabStops[])
Sets tab stops.

Parameters:
tabStops[] - tab stop positions in pixels. Default: 40, 80, 120, ...
 o getTabStops
 public synchronized int[] getTabStops()
Returns the tab stop positions in pixels.

 o 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
 o getLineSpacing
 public synchronized double getLineSpacing()
Returns the line spacing for the label.

 o setLeftInset
 public void setLeftInset(int leftInset)
Sets the left inset in pixels.

Parameters:
leftInset - left inset in pixels. Default: 0
 o getLeftInset
 public synchronized int getLeftInset()
Returns the left inset of the label.

 o setRightInset
 public void setRightInset(int rightInset)
Sets the right inset in pixels.

Parameters:
rightInset - right inset in pixels. Default: 0
 o getRightInset
 public synchronized int getRightInset()
Returns the right inset of the label.

 o setTopInset
 public void setTopInset(int topInset)
Sets the top inset in pixels.

Parameters:
topInset - top inset in pixels. Default: 0
 o getTopInset
 public synchronized int getTopInset()
Returns the top inset of the label.

 o setBottomInset
 public void setBottomInset(int bottomInset)
Sets the bottom inset in pixels.

Parameters:
bottomInset - bottom inset in pixels. Default 0
 o getBottomInset
 public synchronized int getBottomInset()
Returns the bottom inset of the label.

 o 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
 o getWrap
 public synchronized boolean getWrap()
Returns whether automatic line wrapping is enabled or disabled.

 o setLabelWidth
 public void setLabelWidth(int width)
Sets width of the label.

Parameters:
width - width of the label in pixels. Default: 150
 o getLabelWidth
 public synchronized int getLabelWidth()
Returns the width of the component.

 o setCopyright
 public void setCopyright(String str)
 o getCopyright
 public synchronized String getCopyright()
 o addPropertyChangeListener
 public void addPropertyChangeListener(PropertyChangeListener listener)
Overrides:
addPropertyChangeListener in class JComponent
 o removePropertyChangeListener
 public void removePropertyChangeListener(PropertyChangeListener listener)
Overrides:
removePropertyChangeListener in class JComponent
 o paint
 public void paint(Graphics g)
Paints the JMultiLineLabel component using the given graphics context

Parameters:
g - the graphics context used for painting the component
Overrides:
paint in class JComponent
 o 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 JComponent
See Also:
getMinimumSize
 o preferredSize
 public Dimension preferredSize()
Note: preferredSize() is deprecated.

Overrides:
preferredSize in class Container
See Also:
getPreferredSize
 o 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 JComponent
See Also:
getPreferredSize
 o minimumSize
 public Dimension minimumSize()
Note: minimumSize() is deprecated.

Overrides:
minimumSize in class Container
See Also:
getMinimumSize
 o 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
 o 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
 o 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
 o getAccessibleContext
 public AccessibleContext getAccessibleContext()
Get the AccessibleContext of this object

Returns:
the AccessibleContext of this object
Overrides:
getAccessibleContext in class JComponent
 o getLabelFor
 public Component getLabelFor()
Get the component this is labelling.

Returns:
the Component this is labelling. Can be null if this does not label a Component. If the displayedMnemonic property is set and the labelFor property is also set, the label will call the requestFocus method of the component specified by the labelFor property when the mnemonic is activated.
See Also:
getDisplayedMnemonic, setDisplayedMnemonic
 o setLabelFor
 public void setLabelFor(Component c)
Set the component this is labelling. Can be null if this does not label a Component. If the displayedMnemonic property is set and the labelFor property is also set, the label will call the requestFocus method of the component specified by the labelFor property when the mnemonic is activated.

Parameters:
c - the Component this label is for, or null if the label is not the label for a component
See Also:
getDisplayedMnemonic, setDisplayedMnemonic
 o updateUI
 public void updateUI()
Notification from UIFractory that the L&F has changed, JMultiLineLabel simply reuses the JLabel look and feel elements for foreground color, background color, and font

Overrides:
updateUI in class JComponent

All Packages  Class Hierarchy  This Package  Previous  Next  Index