Package java.awt

Examples of java.awt.Desktop.browse()


     */
    public static void open(URL location) {
        Desktop desktop = Desktop.getDesktop();

        try {
            desktop.browse(location.toURI());
        } catch(IOException exception) {
            System.err.println("Unable to open URL in default browser: " + exception.getMessage());
        } catch(URISyntaxException exception) {
            System.err.println("Unable to open URL in default browser: " + exception.getMessage());
        }
View Full Code Here


  public void openURL(String URL) {
    if (Desktop.isDesktopSupported()) {
      Desktop desktop = Desktop.getDesktop();
      if (desktop.isSupported(Desktop.Action.BROWSE)) {
        try {
          desktop.browse(new URI(URL));
        } catch(Exception e) {
          JOptionPane.showMessageDialog(f,
            "Failed to launch your browser!\nLaunch your browser and enter \""+
            URL+"\" into the navigation bar.",
            "Error", JOptionPane.ERROR_MESSAGE);
View Full Code Here

  public void openURL(String URL) {
    if (Desktop.isDesktopSupported()) {
      Desktop desktop = Desktop.getDesktop();
      if (desktop.isSupported(Desktop.Action.BROWSE)) {
        try {
          desktop.browse(new URI(URL));
        } catch(Exception e) {
          JOptionPane.showMessageDialog(f,
            "Failed to launch your browser!\nLaunch your browser and enter \""+
            URL+"\" into the navigation bar.",
            "Error", JOptionPane.ERROR_MESSAGE);
View Full Code Here

  public static void display(URI uri) {
    if (!GuiUtils.isInteractive())
      return;
    try {
      Desktop d = Desktop.getDesktop();
      d.browse(uri);
    } catch (UnsupportedOperationException ex) {
      // KDE isn't supported :(
      if (Utils.getOperatingSystem().contains("linux")
          || Utils.getOperatingSystem().contains("unix")) {
        Process p = new Process("xdg-open " + uri);
View Full Code Here

    if( Desktop.isDesktopSupported() )
    {
      Desktop desktop = Desktop.getDesktop();
      try
      {
        desktop.browse( new URI( url ) );
      }
      catch( IOException ex )
      {
        throw new Error( ex );
      }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.