Package adams.gui.core
Class BrowserHelper
- java.lang.Object
-
- adams.gui.core.BrowserHelper
-
public class BrowserHelper extends Object
A little helper class for browser related stuff.
TheopenURL
method was originally based on Bare Bones Browser Launch, which has been placed in the public domain.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BrowserHelper.DefaultHyperlinkListener
Default handler for hyperlinks.
-
Field Summary
Fields Modifier and Type Field Description static String
FILENAME
the file for the properties.protected static Properties
m_Properties
the general properties.
-
Constructor Summary
Constructors Constructor Description BrowserHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static JLabel
createLink(String url, String text)
Generates a label with a clickable link.static Properties
getProperties()
Returns the properties that define the editor.static String
openURL(Component parent, String url)
Opens the URL in the system's default browser.static String
openURL(Component parent, String url, boolean showDialog)
Opens the URL in the system's default browser.static String
openURL(Component parent, String cmd, String url, boolean showDialog)
Opens the URL in a custom browser.static String
openURL(String url)
Opens the URL in the system's default browser.
-
-
-
Field Detail
-
FILENAME
public static final String FILENAME
the file for the properties.- See Also:
- Constant Field Values
-
m_Properties
protected static Properties m_Properties
the general properties.
-
-
Method Detail
-
openURL
public static String openURL(String url)
Opens the URL in the system's default browser.- Parameters:
url
- the URL to open, use tab to separate multiple URLs- Returns:
- null if executed OK, otherwise error message
-
openURL
public static String openURL(Component parent, String url)
Opens the URL in the system's default browser.- Parameters:
parent
- the parent componenturl
- the URL to open, use tab to separate multiple URLs- Returns:
- null if executed OK, otherwise error message
-
openURL
public static String openURL(Component parent, String url, boolean showDialog)
Opens the URL in the system's default browser.- Parameters:
parent
- the parent componenturl
- the URL to open, use tab to separate multiple URLsshowDialog
- whether to display a dialog in case of an error or just print the error to the console- Returns:
- null if executed OK, otherwise error message
-
openURL
public static String openURL(Component parent, String cmd, String url, boolean showDialog)
Opens the URL in a custom browser.- Parameters:
parent
- the parent componentcmd
- the browser command-lineurl
- the URL to openshowDialog
- whether to display a dialog in case of an error or just print the error to the console- Returns:
- null if executed OK, otherwise error message
-
createLink
public static JLabel createLink(String url, String text)
Generates a label with a clickable link.- Parameters:
url
- the url of the linktext
- the text to display instead of URL. if null or of length 0 then the URL is used- Returns:
- the generated label
-
getProperties
public static Properties getProperties()
Returns the properties that define the editor.- Returns:
- the properties
-
-