|
swingx Version 2005-08-19 |
|||||||||
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.AbstractButton
javax.swing.JButton
org.jdesktop.swingx.JXHyperlink
public class JXHyperlink
A hyperlink component that derives from JButton to provide compatibility mostly for binding actions enabled/disabled behavior accesilibity i18n etc...
This button has visual state related to a notion of "clicked":
foreground color is unclickedColor or clickedColor depending on
its boolean bound property clicked being false or true, respectively.
If the hyperlink has an action, it guarantees to synchronize its
"clicked" state to an action value with key LinkAction.VISITED_KEY.
Synchronization happens on setAction() and on propertyChange notification
from the action. JXHyperlink accepts any type of action -
LinkAction
is a convenience implementation to
simplify clicked control.
LinkAction linkAction = new LinkAction("http://swinglabs.org") {
public void actionPerformed(ActionEvent e) {
doSomething(getTarget());
setVisited(true);
}
};
JXHyperlink hyperlink = new JXHyperlink(linkAction);
The hyperlink can be configured to always update its clicked
property after firing the actionPerformed:
JXHyperlink hyperlink = new JXHyperlink(action);
hyperlink.setOverrulesActionOnClick(true);
By default, this property is false. The hyperlink will
auto-click only if it has no action. Developers can change the
behaviour by overriding isAutoSetClicked()
;
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JButton |
---|
JButton.AccessibleJButton |
Nested classes/interfaces inherited from class javax.swing.AbstractButton |
---|
AbstractButton.AccessibleAbstractButton, AbstractButton.ButtonChangeListener |
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.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
static String |
uiClassID
|
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 | |
---|---|
JXHyperlink()
Creates a new instance of JXHyperlink with default parameters |
|
JXHyperlink(Action action)
Creates a new instance of JHyperLink and configures it from provided Action. |
Method Summary | |
---|---|
protected void |
configurePropertiesFromAction(Action a)
Read all the essentional properties from the provided Action
and apply it to the JXHyperlink |
protected PropertyChangeListener |
createActionPropertyChangeListener(Action a)
Create listener that will watch the changes of the provided Action
and will update JXHyperlink's properties accordingly. |
protected void |
fireActionPerformed(ActionEvent event)
override to control auto-clicked. |
Color |
getClickedColor()
|
boolean |
getOverrulesActionOnClick()
Returns whether the clicked property should be set always on clicked. |
String |
getUIClassID()
Returns a string that specifies the name of the L&F class that renders this component. |
Color |
getUnclickedColor()
|
protected boolean |
isAutoSetClicked()
Decides auto-setting of clicked property after firing action events. |
boolean |
isClicked()
|
void |
setClicked(boolean clicked)
Sets the clicked property and updates visual state depending on clicked. |
void |
setClickedColor(Color color)
Sets the color for the previously not visited link. |
void |
setOverrulesActionOnClick(boolean overrule)
Control auto-click property. |
void |
setUnclickedColor(Color color)
Sets the color for the previously visited link. |
Methods inherited from class javax.swing.JButton |
---|
getAccessibleContext, isDefaultButton, isDefaultCapable, paramString, removeNotify, setDefaultCapable, updateUI |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String uiClassID
getUIClassID()
,
JComponent.readObject(java.io.ObjectInputStream)
,
Constant Field ValuesConstructor Detail |
---|
public JXHyperlink()
public JXHyperlink(Action action)
action
- Action whose parameters will be borrowed to configure newly
created JXHyperLinkMethod Detail |
---|
public Color getUnclickedColor()
public void setClickedColor(Color color)
color
- Color for the hyper link if it has not yet been clicked.public Color getClickedColor()
public void setUnclickedColor(Color color)
color
- Color for the hyper link if it has already been clicked.public void setClicked(boolean clicked)
clicked
- flag to indicate if the button should be regarded
as having been clicked or not.public boolean isClicked()
true
if hyper link has already been clicked.public void setOverrulesActionOnClick(boolean overrule)
overrule
- if true, fireActionPerformed will set clicked to true
independent of action.public boolean getOverrulesActionOnClick()
protected void fireActionPerformed(ActionEvent event)
fireActionPerformed
in class AbstractButton
protected boolean isAutoSetClicked()
protected PropertyChangeListener createActionPropertyChangeListener(Action a)
Action
and will update JXHyperlink's properties accordingly.
createActionPropertyChangeListener
in class AbstractButton
protected void configurePropertiesFromAction(Action a)
Action
and apply it to the JXHyperlink
configurePropertiesFromAction
in class JButton
public String getUIClassID()
getUIClassID
in class JButton
|
swingx Version 2005-08-19 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |