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.
-
labelFor
- --- Accessibility Support ---
-
JMultiLineLabel()
- Construct a JMultiLineLabel object with an empty label and default width
-
JMultiLineLabel(String)
- Construct a JMultiLineLabel object with the specified string as the label
-
JMultiLineLabel(String, int)
- Construct a JMultiLineLabel object with the specified string as the label
and with initial width in pixels
-
addPropertyChangeListener(PropertyChangeListener)
-
-
getAccessibleContext()
-
Get the AccessibleContext of this object
-
getBottomInset()
- Returns the bottom inset of the label.
-
getCopyright()
-
-
getLabelFor()
- Get the component this is labelling.
-
getLabelWidth()
- Returns the width of the component.
-
getLeftInset()
- Returns the left inset of the label.
-
getLineSpacing()
- Returns the line spacing for the label.
-
getMinimumSize()
- Returns the minimum size for displaying this component.
-
getPixelsPerTab()
- Returns the pixels per tab stop for the label.
-
getPreferredSize()
- Returns the recommended size for displaying this component.
-
getRightInset()
- Returns the right inset of the label.
-
getTabStops()
- Returns the tab stop positions in pixels.
-
getText()
- Returns the label's text string.
-
getTopInset()
- Returns the top inset of the label.
-
getWrap()
- Returns whether automatic line wrapping is enabled or disabled.
-
minimumSize()
-
Deprecated.
-
paint(Graphics)
- Paints the JMultiLineLabel component using the given graphics context
-
preferredSize()
-
Deprecated.
-
removePropertyChangeListener(PropertyChangeListener)
-
-
setBottomInset(int)
- Sets the bottom inset in pixels.
-
setBounds(int, int, int, int)
- Moves and resizes this component.
-
setCopyright(String)
-
-
setLabelFor(Component)
- Set the component this is labelling.
-
setLabelWidth(int)
- Sets width of the label.
-
setLeftInset(int)
- Sets the left inset in pixels.
-
setLineSpacing(double)
- Sets the line spacing, in multiples of fontHeight.
-
setLocation(int, int)
- Set location for this component.
-
setPixelsPerTab(int)
- Sets the pixels per tab stop.
-
setRightInset(int)
- Sets the right inset in pixels.
-
setSize(int, int)
- Resizes this component.
-
setTabStops(int[])
- Sets tab stops.
-
setText(String)
- Sets the text label.
-
setTopInset(int)
- Sets the top inset in pixels.
-
setWrap(boolean)
- Sets whether automatic line wrap is enabled or disabled.
-
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
labelFor
protected Component labelFor
- --- Accessibility Support ---
JMultiLineLabel
public JMultiLineLabel(String string,
int width)
- Construct a JMultiLineLabel object with the specified string as the label
and with initial width in pixels
JMultiLineLabel
public JMultiLineLabel(String string)
- Construct a JMultiLineLabel object with the specified string as the label
JMultiLineLabel
public JMultiLineLabel()
- Construct a JMultiLineLabel 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 JMultiLineLabel,
which may (or may not) have embedded line.separators and tabs
getText
public synchronized String getText()
- Returns the label's text string.
setPixelsPerTab
public void setPixelsPerTab(int pixelsPerTab)
- Sets the pixels per tab stop.
- Parameters:
- pixelsPerTab - pixels per tab stop. Default: 40
getPixelsPerTab
public synchronized int getPixelsPerTab()
- Returns the pixels per tab stop for the label.
setTabStops
public void setTabStops(int tabStops[])
- Sets tab stops.
- Parameters:
- tabStops[] - tab stop positions in pixels. Default: 40, 80, 120, ...
getTabStops
public synchronized int[] getTabStops()
- Returns the tab stop positions in pixels.
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.
setLeftInset
public void setLeftInset(int leftInset)
- Sets the left inset in pixels.
- Parameters:
- leftInset - left inset in pixels. Default: 0
getLeftInset
public synchronized int getLeftInset()
- Returns the left inset of the label.
setRightInset
public void setRightInset(int rightInset)
- Sets the right inset in pixels.
- Parameters:
- rightInset - right inset in pixels. Default: 0
getRightInset
public synchronized int getRightInset()
- Returns the right inset of the label.
setTopInset
public void setTopInset(int topInset)
- Sets the top inset in pixels.
- Parameters:
- topInset - top inset in pixels. Default: 0
getTopInset
public synchronized int getTopInset()
- Returns the top inset of the label.
setBottomInset
public void setBottomInset(int bottomInset)
- Sets the bottom inset in pixels.
- Parameters:
- bottomInset - bottom inset in pixels. Default 0
getBottomInset
public synchronized int getBottomInset()
- Returns the bottom inset 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
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)
- Overrides:
- addPropertyChangeListener in class JComponent
removePropertyChangeListener
public void removePropertyChangeListener(PropertyChangeListener listener)
- Overrides:
- removePropertyChangeListener in class JComponent
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
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
preferredSize
public Dimension preferredSize()
- Note: preferredSize() is deprecated.
- Overrides:
- preferredSize in class Container
- 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 JComponent
- See Also:
- getPreferredSize
minimumSize
public Dimension minimumSize()
- Note: minimumSize() is deprecated.
- Overrides:
- minimumSize in class Container
- 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
getAccessibleContext
public AccessibleContext getAccessibleContext()
- Get the AccessibleContext of this object
- Returns:
- the AccessibleContext of this object
- Overrides:
- getAccessibleContext in class JComponent
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
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
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