public class BrowserControl
extends java.lang.Object
A simple, static class to display a URL in the system browser.
Under Unix systems, it will open one of the browser set through the
setBrowserCommand(String). The argument of this method
must be a fully qualified command or one of the commands returned
by getSupportedBrowsers().
By default, the browser is Firefox,
which is included in the list of supported browsers.
Under Windows, this will bring up the default browser under windows,
usually either Netscape or Microsoft IE. The default browser is
determined by the OS so no config is necessary.
This has been tested under Windows 95/98/NT/XP.
Notice that you must include the url type -- either "http://" or "file://".
Under Mac, the usability of this class is pending of test. So probably it does not work
Examples: BrowserControl.displayURL("http://www.javaworld.com") BrowserControl.displayURL("file://c:\\docs\\index.html") BrowserContorl.displayURL("file:///user/joe/index.html");Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CHROME |
static java.lang.String |
EPIPHANY |
static java.lang.String |
FIREFOX |
static java.lang.String |
GALEON |
static java.lang.String |
KONQUEROR |
static java.lang.String |
MOZILLA |
static java.lang.String |
NETSCAPE |
static java.lang.String |
OPERA |
Constructor and Description |
---|
BrowserControl() |
Modifier and Type | Method and Description |
---|---|
void |
displayURL(java.lang.String url)
Display a file in the system browser.
|
java.util.List<java.lang.String> |
getSupportedBrowsers()
Returns a list of supported browsers.
|
static boolean |
isWindowsPlatform()
Try to determine whether this application is running under Windows
or some other platform by examing the "os.name" property.
|
public static final java.lang.String OPERA
public static final java.lang.String NETSCAPE
public static final java.lang.String MOZILLA
public static final java.lang.String GALEON
public static final java.lang.String EPIPHANY
public static final java.lang.String FIREFOX
public static final java.lang.String CHROME
public static final java.lang.String KONQUEROR
public void displayURL(java.lang.String url)
url
- the file's url (the url must start with either "http://" or "file://").public static boolean isWindowsPlatform()
public java.util.List<java.lang.String> getSupportedBrowsers()