Class BrowserHelper

java.lang.Object
nz.ac.waikato.cms.core.BrowserHelper

public class BrowserHelper extends Object
A little helper class for browser related stuff.

The openURL method was originally based on Bare Bones Browser Launch, which has been placed in the public domain.
Version:
$Revision: 10824 $
Author:
fracpete (fracpete at waikato dot ac dot nz)
  • Field Details

    • LINUX_BROWSERS

      public static final String[] LINUX_BROWSERS
  • Constructor Details

    • BrowserHelper

      public BrowserHelper()
  • Method Details

    • openURL

      public static String openURL(String url)
      Opens the URL in the system's default browser.
      Parameters:
      url - the URL to open
      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 component
      url - the URL to open
      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 component
      url - the URL to open
      showDialog - 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 component
      cmd - the browser command-line
      url - the URL to open
      showDialog - 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