|
Diamond Control Suite 3.0 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
diamondedge.swing.DsLabel
public class DsLabel
DsLabel displays multiple lines of text and/or an icon that a user can't change directly. It is a replacement to and uses the same API as JLabel. It breaks the text up into multiple lines when WordWrap is turned on. Many other additional features are available such as rotation, margins, text styles (3D and highlighting), built-in borders, and font underlining and strikethrough.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary |
|---|
| Fields inherited from class javax.swing.JComponent |
|---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface diamondedge.swing.DsConstants |
|---|
ACCOUNTING, ALL, ASCENDING, ASCENDING_CASE, BORDER_BOTTOM, BORDER_LEFT, BORDER_NONE, BORDER_OUTLINE, BORDER_RIGHT, BORDER_TOP, CROSS_LINES, DASH, DASH_DOT, DASH_DOT_DOT, DEFAULT, DESCENDING, DESCENDING_CASE, DIAGONAL_CROSS_LINES, DOT, DOUBLE, DOUBLE_LINE, DOWNWARD_DIAGONAL_LINES, ETCHED, ETCHED_RAISED, FALSE, FIND_ALL, FIND_EQUALS, FIND_GT, FIND_GTE, FIND_LT, FIND_LTE, FIND_NE, FIND_PREFIX, FIND_REGEX, FIND_STRING, FIRST, FLAT, GRID_DASH, GRID_DASH_DOT, GRID_DASH_DOT_DOT, GRID_DOT, GRID_LINE, HIGHLIGHT_SELECTION_ALWAYS, HIGHLIGHT_SELECTION_NEVER, HIGHLIGHT_SELECTION_WITH_FOCUS, HORIZONTAL_LINES, LOWERED, LOWERED_LIGHT, NONE, RAISED, RAISED_LIGHT, SELECT_CELL, SELECT_NONE, SELECT_ROW, SINGLE, SINGLE_LINE, SOLID, STRETCH, TILE, TRANSPARENT, TRUE, UPWARD_DIAGONAL_LINES, VERTICAL_LINES |
| Fields inherited from interface javax.swing.SwingConstants |
|---|
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
DsLabel()
Creates a DsLabel without an icon and a blank string for the text. |
|
DsLabel(Icon icon)
Creates a DsLabel with an icon which is centered vertically and horizontally. |
|
DsLabel(Icon icon,
int horizontalAlignment)
Creates a DsLabel with an icon which is centered vertically and the specified horizontal alignment. |
|
DsLabel(String text)
Creates a DsLabel with the specified text and without an icon. |
|
DsLabel(String text,
Icon icon,
int horizontalAlignment)
Creates a DsLabel with the specified text, icon and horizontal alignment. |
|
DsLabel(String text,
int horizontalAlignment)
|
|
| Method Summary | |
|---|---|
void |
addTextListener(TextListener l)
Adds the specified text listener to receive text events |
protected Border |
createBorder()
|
protected void |
fireLabelChangedEvent()
Fire an text event to the listeners |
Paint |
getBackgroundPaint()
|
int |
getCenterBorder()
Returns whether to draw a border in between the InnerBorder and the OuterBorder. |
Icon |
getDisabledIcon()
Returns the graphic image (glyph, icon) that the label displays when the label is disabled. |
char |
getDisplayedMnemonic()
Returns the character that indicates a mnemonic key. |
int |
getFontUnderline()
Returns a value that determines how the text for the label is underlined. |
Paint |
getForegroundPaint()
|
int |
getHorizontalAlignment()
Returns the horizontal alignment of the contents (text and icon) within the Label |
int |
getHorizontalTextPosition()
Returns the horizontal position of the text relative to the icon |
Icon |
getIcon()
Returns the graphic image (glyph, icon) that the label displays. |
int |
getIconTextGap()
Returns the amount of space between the text and the icon displayed in this label. |
int |
getInnerBorder()
Returns whether to draw a border inside of the CenterBorder. |
Insets |
getInsets()
Returns the insets which includes the border's insets and the margin. |
Insets |
getInsets(Insets insets)
Returns the insets which includes the border's insets and the margin. |
Component |
getLabelFor()
Get the component this is labelling. |
Color |
getLineBorderColor()
Returns the color used to draw the line border. |
int |
getLineBorderWidth()
Returns the width of the line border drawn around the label. |
Insets |
getMargins()
Returns the spacing between the border and the contents (text/icon). |
Dimension |
getMinimumSize()
This method is called when the layout manager wants to know the bare minimum amount of space we need to get by. |
int |
getOuterBorder()
Returns whether to draw a border on the outside of the label but inside of the outline if it exists. |
Dimension |
getPreferredSize()
This method is called by a layout manager when it wants to know how big we'd like to be. |
int |
getRotation()
Returns the degrees to rotate text and icon. |
String |
getText()
Returns the text that the label displays |
Color |
getTextOutlineColor()
Returns the color used to draw an outline around each character of the text. |
double |
getTextOutlineWidth()
Returns the width of the outline drawn around each character in the text. |
int |
getTextStyle()
Returns a value that determines how the text is drawn. |
int |
getVerticalAlignment()
Returns the vertical alignment of the contents (text and icon) within the Label |
int |
getVerticalTextPosition()
Returns the vertical position of the text relative to the icon |
boolean |
isAutoSize()
Returns a value that determines whether the label is automatically resized to display its entire contents. |
boolean |
isFontStrikeThrough()
Returns a value that determines whether the text for the label is displayed with a line through the text. |
boolean |
isWordWrap()
Returns a value that determines whether the text should be wrapped to a new line when it reaches the trailing margin. |
protected void |
paintComponent(Graphics g)
|
void |
removeTextListener(TextListener l)
Removes the specified text listener so it no longer receives text events. |
void |
setAutoSize(boolean s)
Sets a value that determines whether the label is automatically resized to display its entire contents. |
void |
setBackground(Color c)
|
void |
setBackgroundPaint(Paint p)
|
protected void |
setBorders()
|
void |
setBounds(int x,
int y,
int width,
int height)
Moves and resizes this component. |
void |
setCenterBorder(int val)
Creates a border in between the InnerBorder and the OuterBorder. |
void |
setDisabledIcon(Icon icon)
Defines the icon this component will display when the label is disabled. |
void |
setDisplayedMnemonic(char mnemonicChar)
Specify a character that indicates a mnemonic key. |
void |
setFont(Font f)
|
void |
setFontStrikeThrough(boolean strikeThrough)
Sets a value that determines whether the text for the label is displayed with a line through the text. |
void |
setFontUnderline(int underline)
Sets a value that determines how the text for the label is underlined. |
void |
setForeground(Color c)
Sets the text color (ForegroundPaint property). |
void |
setForegroundPaint(Paint p)
|
void |
setHorizontalAlignment(int align)
Sets the horizontal alignment of the contents (text and icon) within the Label. |
void |
setHorizontalTextPosition(int textPosition)
Sets the horizontal position of the text relative to the icon. |
void |
setIcon(Icon icon)
Defines the icon this component will display. |
void |
setIconTextGap(int iconTextGap)
If both the icon and text properties are set, this property defines the space between them. |
void |
setInnerBorder(int val)
Creates a border on the inside of the CenterBorder. |
void |
setLabelFor(Component c)
Specify the component on which the label will call the requestFocus method when the mnemonic is activated. |
void |
setLineBorderColor(Color c)
Sets the color used to draw the line border. |
void |
setLineBorderWidth(int lineWidth)
Sets the width of the line border drawn around the label. |
void |
setMargins(Insets margins)
Sets the spacing between the border and the contents (text/icon). |
void |
setOuterBorder(int val)
Creates a border on the outside of the label but inside of the outline if it exists. |
void |
setRotation(int val)
Set the degrees to rotate the text and icon. |
void |
setText(String text)
Sets the text that the label displays. |
void |
setTextOutlineColor(Color c)
Sets the color used to draw an outline around each character of the text. |
void |
setTextOutlineWidth(double lineWidth)
Sets the width of the outline drawn around each character in the text. |
void |
setTextStyle(int style)
Sets a value that determines how the text is drawn. |
void |
setVerticalAlignment(int a)
Sets the vertical alignment of the contents (text and icon) within the Label. |
void |
setVerticalTextPosition(int textPosition)
Sets the vertical position of the text relative to the icon. |
void |
setWordWrap(boolean s)
Sets a value that determines whether the text should be wrapped to a new line when it reaches the trailing margin. |
void |
updateUI()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public DsLabel(String text,
Icon icon,
int horizontalAlignment)
text - The text displayed in the label.icon - The icon displayed next to the text.horizontalAlignment - The horizontal alignment of the contents (text and icon) within the Label. One of: LEFT, CENTER, RIGHT, LEADING or TRAILINGpublic DsLabel(String text)
public DsLabel(String text,
int horizontalAlignment)
public DsLabel(Icon icon)
public DsLabel(Icon icon,
int horizontalAlignment)
horizontalAlignment - - One of: LEFT, CENTER, RIGHT, LEADING or TRAILINGpublic DsLabel()
| Method Detail |
|---|
public void updateUI()
updateUI in class JComponentpublic void setForeground(Color c)
setForeground in class JComponentpublic Paint getForegroundPaint()
public void setForegroundPaint(Paint p)
public void setBackground(Color c)
setBackground in class JComponentpublic Paint getBackgroundPaint()
public void setBackgroundPaint(Paint p)
public boolean isAutoSize()
public void setAutoSize(boolean s)
public boolean isWordWrap()
public void setWordWrap(boolean s)