|
||||||||||
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
javax.swing.JLabel
com.jgoodies.uif.component.UIFLabel
com.jgoodies.uifextras.util.ActionLabel
public final class ActionLabel
A UIFLabel subclass that paints a hyperlink-like underline on mouseover. Mouse clicks can perform an action either by setting this label's Action or by adding an ActionListener to this label.
If the mouse enters this label the hand cursor is set; this cursor will be removed either if the mouse exited or if the action performed makes the label not showing.
TODO: Consider adding support for mnemonics.
Action
,
ActionListener
,
Component.isShowing()
,
Serialized FormNested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JLabel |
---|
JLabel.AccessibleJLabel |
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 com.jgoodies.uif.component.UIFLabel |
---|
PROPERTYNAME_ANTI_ALIASED, PROPERTYNAME_FONT_SIZE_DELTA, PROPERTYNAME_FONT_STYLE |
Fields inherited from class javax.swing.JLabel |
---|
labelFor |
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 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 | |
---|---|
ActionLabel(Action action)
Creates an ActionLabel where properties are taken from the Action supplied. |
|
ActionLabel(String text)
Creates an ActionLabel with the given text. |
|
ActionLabel(String text,
Color linkColor,
Color backgroundColor)
Creates an ActionLabel with the given text, and colors for the link and label background. |
|
ActionLabel(String text,
Color linkColor,
Color backgroundColor,
Icon icon,
int horizontalAlignment)
Creates an ActionLabel with the given text, link color, background color, icon, and horizontal alignment. |
|
ActionLabel(String text,
Icon icon,
int horizontalAlignment)
Creates an ActionLabel with the given text, icon, and horizontal alignment. |
Method Summary | |
---|---|
void |
addActionListener(ActionListener listener)
Adds an action listener to receive action events from this label. |
Action |
getAction()
Returns the currently set Action for this
ActionEvent source, or null
if no Action is set. |
Color |
getBackgroundColor()
Returns the background color for the activated label. |
Icon |
getDisabledIcon()
Returns the icon used by this label when it's disabled. |
Color |
getLinkColor()
Returns the color for the activated label. |
void |
paint(Graphics g)
Paints the label. |
void |
removeActionListener(ActionListener listener)
Removes the given action listener from the list of action listeners associated with this label. |
void |
setAction(Action a)
Sets the Action for the ActionEvent source. |
void |
setBackgroundColor(Color color)
Sets the background color for the activated label. |
void |
setLinkColor(Color color)
Sets the color for the activated label. |
Methods inherited from class com.jgoodies.uif.component.UIFLabel |
---|
getFontSizeDelta, getFontStyle, isAntiAliased, setAntiAliased, setFontSizeDelta, setFontStyle, updateUI |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ActionLabel(String text)
text
- the text to be displayedpublic ActionLabel(String text, Icon icon, int horizontalAlignment)
text
- the text to be displayedicon
- the icon to be displayedhorizontalAlignment
- one of the following constants
defined in SwingConstants
:
LEFT
,
CENTER
,
RIGHT
,
LEADING
or
TRAILING
public ActionLabel(String text, Color linkColor, Color backgroundColor)
text
- the text to be displayedlinkColor
- the color of the activated labelbackgroundColor
- the background color of the activated labelpublic ActionLabel(String text, Color linkColor, Color backgroundColor, Icon icon, int horizontalAlignment)
text
- the text to be displayedlinkColor
- the color of the activated labelbackgroundColor
- the background color of activated labelicon
- the icon to be displayedhorizontalAlignment
- one of the following constants
defined in SwingConstants
:
LEFT
,
CENTER
,
RIGHT
,
LEADING
or
TRAILING
public ActionLabel(Action action)
action
- the Action used to specify the new ActionLabelMethod Detail |
---|
public Color getLinkColor()
public void setLinkColor(Color color)
color
- color of activated labelpublic Color getBackgroundColor()
public void setBackgroundColor(Color color)
color
- background color of activated labelpublic Action getAction()
Action
for this
ActionEvent
source, or null
if no Action
is set.
Action
for this ActionEvent
source, or null
Action
,
setAction(Action)
public void setAction(Action a)
Action
for the ActionEvent
source.
The new Action
replaces any previously set
Action
but does not affect ActionListeners
independently added with addActionListener
.
If the Action
is already a registered
ActionListener
for the button, it is not re-registered.
A side-effect of setting the Action
is that the
ActionEvent
source's properties are immediately
set from the values in the Action
(performed by the
method configurePropertiesFromAction
) and
subsequently updated as the Action
's properties change
(via a PropertyChangeListener
created by the method
createActionPropertyChangeListener
.
a
- the Action
for the AbstractButton
,
or null
Action
,
getAction()
public void addActionListener(ActionListener listener)
listener
- ActionListener to add to the event queuepublic void removeActionListener(ActionListener listener)
listener
- ActionListener to add to the event queuepublic Icon getDisabledIcon()
getDisabledIcon
in class JLabel
disabledIcon
propertyJLabel.setDisabledIcon(javax.swing.Icon)
public void paint(Graphics g)
paint
in class com.jgoodies.uif.component.UIFLabel
g
- Graphics object for painting
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |