|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.isti.util.BasicLaunchBrowser
public class BasicLaunchBrowser
Basic Browser Launch. Utility class to open a web page from a Swing application in the user's default browser. Supports: Mac OS X, GNU/Linux, Unix, Windows XP/Vista/7 This code was lifted from www.centerkey.com/java/browser
Field Summary | |
---|---|
static java.lang.String[] |
WEB_BROWSERS
The web browsers for Unix/Linux. |
Fields inherited from interface com.isti.util.ILaunchBrowser |
---|
NO_ERROR |
Constructor Summary | |
---|---|
BasicLaunchBrowser()
Creates a launch browser. |
|
BasicLaunchBrowser(java.lang.String[] browsers,
boolean useDesktopFlag)
Creates a launch browser. |
Method Summary | |
---|---|
static void |
browse(java.lang.String urlStr)
Attempts to use the Desktop library from JDK 1.6+ to open a browser. |
java.lang.String |
getErrorMessage()
Returns message string for last error (or 'No error' if none). |
static boolean |
isDesktopAvailable()
Determines if the desktop is available. |
static boolean |
isDesktopAvailable(java.lang.String javaVersionString)
Determines if the desktop is available. |
protected java.lang.String |
launch()
Launch the browser. |
protected java.lang.String |
launch(java.lang.String urlStr)
Launch the browser. |
static void |
main(java.lang.String[] args)
|
boolean |
showURL(java.lang.String urlStr)
Displays the given URL address string in a browser window. |
boolean |
showURL(java.lang.String urlStr,
java.lang.String titleStr)
Displays the given URL address string in a browser window. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String[] WEB_BROWSERS
Constructor Detail |
---|
public BasicLaunchBrowser()
public BasicLaunchBrowser(java.lang.String[] browsers, boolean useDesktopFlag)
browsers
- the web browsers for Unix/Linux.useDesktopFlag
- true to use the java.awt.Desktop, false otherwise.WEB_BROWSERS
,
isDesktopAvailable()
Method Detail |
---|
public static void browse(java.lang.String urlStr) throws java.lang.Exception
urlStr
- a string containing the URL.
java.lang.Exception
- if error.isDesktopAvailable()
public java.lang.String getErrorMessage()
getErrorMessage
in interface ILaunchBrowser
public static boolean isDesktopAvailable()
public static boolean isDesktopAvailable(java.lang.String javaVersionString)
javaVersionString
- the Java version string.
UtilFns.getJavaVersion()
public boolean showURL(java.lang.String urlStr)
showURL
in interface ILaunchBrowser
urlStr
- a string containing the URL.
public boolean showURL(java.lang.String urlStr, java.lang.String titleStr)
showURL
in interface ILaunchBrowser
urlStr
- a string containing the URL.titleStr
- a string used to select a target browser window or null if
none.
protected java.lang.String launch()
protected java.lang.String launch(java.lang.String urlStr)
urlStr
- the URL string.
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |