public class BrowserControl extends 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 String |
EPIPHANY |
static String |
FIREFOX |
static String |
GALEON |
static String |
KONQUEROR |
static String |
MOZILLA |
static String |
NETSCAPE |
static String |
OPERA |
Constructor and Description |
---|
BrowserControl() |
Modifier and Type | Method and Description |
---|---|
static void |
displayURL(String url)
Display a file in the system browser.
|
static ArrayList |
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.
|
static void |
setBrowserCommand(String browserCommand) |
public static final String OPERA
public static final String NETSCAPE
public static final String MOZILLA
public static final String GALEON
public static final String EPIPHANY
public static final String FIREFOX
public static final String KONQUEROR
public static void displayURL(String url)
url
- the file's url (the url must start with either "http://" or "file://").public static boolean isWindowsPlatform()
public static void setBrowserCommand(String browserCommand)
public static ArrayList getSupportedBrowsers()