net.sourceforge.helpgui.util
Class BrowserControl

java.lang.Object
  extended by net.sourceforge.helpgui.util.BrowserControl

public class BrowserControl
extends java.lang.Object

A simple, static class to display an URL in the system browser. Under Windows, this will bring up the default browser, usually either Netscape or Microsoft IE. The default browser is determined by the OS. This has been tested under: Windows 95/98/NT/2000. Under MacOS, this will bring up the default browser. The default browser is determined by the OS. This has been tested under: n/a In other cases (and under Unix), the system browser is hard-coded to be 'netscape'. Netscape must be in your PATH for this to work. This has been tested with the following platforms: AIX, HP-UX and Solaris. Examples: * BrowserControl.displayURL("http://www.javaworld.com") BrowserControl.displayURL("file://c:\\docs\\index.html") BrowserContorl.displayURL("file:///user/joe/index.html"); Note - you must include the url type -- either "http://" or "file://".


Field Summary
private static java.lang.String[] MAC_CMDLINE
           
private static int MAC_ID
           
private static java.lang.String MAC_PREFIX
           
private static java.lang.String[][] OTHER_CMDLINES
           
private static java.lang.String[][] OTHER_FALLBACKS
           
private static int OTHER_ID
           
private static java.lang.String URLTOKEN
           
private static java.lang.String[] WIN_CMDLINE
           
private static int WIN_ID
           
private static java.lang.String WIN_PREFIX
           
 
Constructor Summary
BrowserControl()
           
 
Method Summary
private static java.lang.String connectStringArray(java.lang.String[] a)
           
static boolean displayURL(java.lang.String url)
          Display an URL in the system browser.
private static int getPlatform()
          Try to determine whether this application is running under Windows or some other platform by examing the "os.name" property.
private static java.lang.String[] replaceToken(java.lang.String[] target, java.lang.String token, java.lang.String replacement)
           
private static boolean runCmdLine(java.lang.String[] cmdLine)
           
private static boolean runCmdLine(java.lang.String[] cmdLine, java.lang.String[] fallBackCmdLine)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

URLTOKEN

private static final java.lang.String URLTOKEN
See Also:
Constant Field Values

WIN_ID

private static final int WIN_ID
See Also:
Constant Field Values

WIN_PREFIX

private static final java.lang.String WIN_PREFIX
See Also:
Constant Field Values

WIN_CMDLINE

private static final java.lang.String[] WIN_CMDLINE

MAC_ID

private static final int MAC_ID
See Also:
Constant Field Values

MAC_PREFIX

private static final java.lang.String MAC_PREFIX
See Also:
Constant Field Values

MAC_CMDLINE

private static final java.lang.String[] MAC_CMDLINE

OTHER_ID

private static final int OTHER_ID
See Also:
Constant Field Values

OTHER_CMDLINES

private static final java.lang.String[][] OTHER_CMDLINES

OTHER_FALLBACKS

private static final java.lang.String[][] OTHER_FALLBACKS
Constructor Detail

BrowserControl

public BrowserControl()
Method Detail

displayURL

public static boolean displayURL(java.lang.String url)
Display an URL in the system browser. If you want to display a file, you must include the absolute path name.

Parameters:
url - the document's url (the url must start with either "http://" or "file://").

getPlatform

private static int getPlatform()
Try to determine whether this application is running under Windows or some other platform by examing the "os.name" property.

Returns:
the ID of the platform

connectStringArray

private static java.lang.String connectStringArray(java.lang.String[] a)

replaceToken

private static java.lang.String[] replaceToken(java.lang.String[] target,
                                               java.lang.String token,
                                               java.lang.String replacement)

runCmdLine

private static boolean runCmdLine(java.lang.String[] cmdLine)

runCmdLine

private static boolean runCmdLine(java.lang.String[] cmdLine,
                                  java.lang.String[] fallBackCmdLine)