Package ca.corbett.extras.io
Class HyperlinkUtil.BrowseAction
java.lang.Object
javax.swing.AbstractAction
ca.corbett.extras.io.HyperlinkUtil.BrowseAction
- All Implemented Interfaces:
ActionListener,Serializable,Cloneable,EventListener,Action
- Enclosing class:
HyperlinkUtil
If the current JRE supports browsing, this action will open the given URI
in the user's default browser. This is equivalent to invoking
one of the openHyperlink methods, but in a convenient Action form for use
with buttons, menu items, etc.
By default, the name of this action is set to the String representation of the given URI. You can change the name later by calling setName(). For example:
// Creates an action with a name equal to the URI string:
HyperlinkUtil.BrowseAction browseAction =
HyperlinkUtil.BrowseAction.of(new URI(someValidUrl));
// Update the name to something more user-friendly:
browseAction.setName("Visit our website!");
- See Also:
-
Field Summary
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabledFields 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 -
Method Summary
Modifier and TypeMethodDescriptionvoidOpens our configured hyperlink when invoked.getName()Returns the name of this action.static HyperlinkUtil.BrowseActionCreates a new BrowseAction for the given URL string and with no popup dialog.static HyperlinkUtil.BrowseActionCreates a new BrowseAction for the given URL string and the given owner Component for showing popup dialogs.static HyperlinkUtil.BrowseActionCreates a new BrowseAction for the given URI and with no popup dialog.static HyperlinkUtil.BrowseActionCreates a new BrowseAction for the given URI and the given owner Component for showing popup dialogs.static HyperlinkUtil.BrowseActionCreates a new BrowseAction for the given URL and with no popup dialog.static HyperlinkUtil.BrowseActionCreates a new BrowseAction for the given URL and the given owner Component for showing popup dialogs.Allows modifying the name of this action after creation.Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
Method Details
-
setName
Allows modifying the name of this action after creation. -
getName
Returns the name of this action. -
of
Creates a new BrowseAction for the given URI and with no popup dialog. -
of
Creates a new BrowseAction for the given URL and with no popup dialog. -
of
Creates a new BrowseAction for the given URL string and with no popup dialog. -
of
Creates a new BrowseAction for the given URI and the given owner Component for showing popup dialogs. -
of
Creates a new BrowseAction for the given URL and the given owner Component for showing popup dialogs. -
of
Creates a new BrowseAction for the given URL string and the given owner Component for showing popup dialogs. -
actionPerformed
Opens our configured hyperlink when invoked.
-