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

public static class HyperlinkUtil.BrowseAction extends AbstractAction
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: