org.jdesktop.swingx.hyperlink
Class HyperlinkAction
java.lang.Object
javax.swing.AbstractAction
org.jdesktop.swingx.action.AbstractActionExt
org.jdesktop.swingx.hyperlink.AbstractHyperlinkAction<URI>
org.jdesktop.swingx.hyperlink.HyperlinkAction
- All Implemented Interfaces:
- ActionListener, ItemListener, Serializable, Cloneable, EventListener, Action
public class HyperlinkAction
- extends AbstractHyperlinkAction<URI>
A implementation wrapping Desktop
actions BROWSE and MAIL, that is
URI-related.
- See Also:
- Serialized Form
Fields inherited from interface javax.swing.Action |
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON |
Methods inherited from class org.jdesktop.swingx.action.AbstractActionExt |
dispose, getAccelerator, getActionCommand, getGroup, getLargeIcon, getLongDescription, getMnemonic, getName, getShortDescription, getSmallIcon, isSelected, isStateAction, setAccelerator, setActionCommand, setGroup, setLargeIcon, setLongDescription, setMnemonic, setMnemonic, setName, setSelected, setShortDescription, setSmallIcon, setStateAction, toString |
HyperlinkAction
public HyperlinkAction()
- Instantiates a HyperlinkAction with action type BROWSE.
- Throws:
HeadlessException
- if GraphicsEnvironment.isHeadless()
returns true
UnsupportedOperationException
- if the current platform doesn't support
Desktop
IllegalArgumentException
- if unsupported action type
HyperlinkAction
public HyperlinkAction(Desktop.Action desktopAction)
- Instantiates a HyperlinkAction with the given action type.
- Parameters:
desktopAction
- the type of desktop action this class should perform, must be
BROWSE or MAIL
- Throws:
HeadlessException
- if GraphicsEnvironment.isHeadless()
returns true
UnsupportedOperationException
- if the current platform doesn't support
Desktop
IllegalArgumentException
- if unsupported action type
HyperlinkAction
public HyperlinkAction(URI uri,
Desktop.Action desktopAction)
- Parameters:
uri
- the target uri, maybe null.desktopAction
- the type of desktop action this class should perform, must be
BROWSE or MAIL
- Throws:
HeadlessException
- if GraphicsEnvironment.isHeadless()
returns true
UnsupportedOperationException
- if the current platform doesn't support
Desktop
IllegalArgumentException
- if unsupported action type
createHyperlinkAction
public static HyperlinkAction createHyperlinkAction(URI uri)
- Factory method to create and return a HyperlinkAction for the given uri. Tries
to guess the appropriate type from the uri. If uri is not null and has a
scheme of mailto, create one of type Mail. In all other cases, creates one
for BROWSE.
- Parameters:
uri
- to uri to create a HyperlinkAction for, maybe null.
- Returns:
- a HyperlinkAction for the given URI.
- Throws:
HeadlessException
- if GraphicsEnvironment.isHeadless()
returns true
UnsupportedOperationException
- if the current platform doesn't support
Desktop
createHyperlinkAction
public static HyperlinkAction createHyperlinkAction(URI uri,
Desktop.Action type)
- Creates and returns a HyperlinkAction with the given target and action type.
- Parameters:
uri
- the target uri, maybe null.desktopAction
- the type of desktop action this class should perform, must be
BROWSE or MAIL
- Returns:
- a HyperlinkAction
- Throws:
HeadlessException
- if GraphicsEnvironment.isHeadless()
returns true
UnsupportedOperationException
- if the current platform doesn't support
Desktop
IllegalArgumentException
- if unsupported action type
actionPerformed
public void actionPerformed(ActionEvent e)
- Description copied from interface:
java.awt.event.ActionListener
- Invoked when an action occurs.
getDesktopAction
public Desktop.Action getDesktopAction()
- Returns:
installTarget
protected void installTarget()
- Description copied from class:
AbstractHyperlinkAction
- hook for subclasses to update internal state after
a new target has been set.
Subclasses are free to decide the details.
Here:
- the text property is set to target.toString or empty String if
the target is null
- visited is set to false.
- Overrides:
installTarget
in class AbstractHyperlinkAction<URI>