Package java.awt

Examples of java.awt.Desktop.browse()


            @Override
            public void buttonPressed(Button button) {
                Desktop desktop = Desktop.getDesktop();

                try {
                    desktop.browse(new URL(YAHOO_FINANCE_HOME).toURI());
                } catch(MalformedURLException exception) {
                    throw new RuntimeException(exception);
                } catch(URISyntaxException exception) {
                    throw new RuntimeException(exception);
                } catch(IOException exception) {
View Full Code Here


        public void actionPerformed(ActionEvent e) {
            if (e.getSource() instanceof LinkModel) {
                final LinkModel link = (LinkModel) e.getSource();
                try {
                    Desktop desktop = Desktop.getDesktop();
                    desktop.browse(link.getURL().toURI());
                    link.setVisited(true);
                } catch (Exception e1) {
                    // TODO: error handling
                }
            }
View Full Code Here

        } else if (ae.getSource().equals(mi_game_stop)) {
            setGameBeingPlayed(false);
        } else if (ae.getSource().equals(mi_help_source)) {
            Desktop desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null;
            try {
                desktop.browse(new URI("https://github.com/Burke9077/Conway-s-Game-of-Life"));
            } catch (Exception ex) {
                JOptionPane.showMessageDialog(null, "Source is available on GitHub at:\nhttps://github.com/Burke9077/Conway-s-Game-of-Life", "Source", JOptionPane.INFORMATION_MESSAGE);
            }
        } else if (ae.getSource().equals(mi_help_about)) {
            JOptionPane.showMessageDialog(null, "Conway's game of life was a cellular animation devised by the mathematician John Conway.\nThis Java, swing based implementation was created by Matthew Burke.\n\nhttp://burke9077.com\nBurke9077@gmail.com\n@burke9077\n\nCreative Commons Attribution 4.0 International");
View Full Code Here

              href = (String)tagA.getAttribute(HTML.Attribute.HREF);
            }
            if (href != null) {
            Desktop desktop = Desktop.getDesktop();
            try {
          desktop.browse(new URI(href));
        } catch (IOException e1) {
           s_log.error("mouseClicked: Unexpected exception "+e1.getMessage());
        } catch (URISyntaxException e1) {
           s_log.error("mouseClicked: Unexpected exception "+e1.getMessage());
        }
View Full Code Here

        // Java 6 specific code of how to run the browser
        if (Desktop.isDesktopSupported()) {
          try {
            Desktop desktop = Desktop.getDesktop();
            if (desktop.isSupported(Desktop.Action.BROWSE)) {
              desktop.browse(new URI(url));
              opened = true;
            }
          } catch (Exception e) {
            // do nothing
            opened = false;
View Full Code Here

      } else if (cmd.startsWith("!")) {
        //javax.swing.JOptionPane.showMessageDialog(null, String.format("http://localhost:%s/%s", port, contextPath));
        ti.displayMessage("TJWS", getResource("label_opening") + cmd.substring(1), TrayIcon.MessageType.INFO);
        Desktop desktop = Desktop.getDesktop();
        // TODO obtain host name, like inetaddress
        desktop.browse(new URI(String.format("http://%s:%s/%s", "localhost", port, cmd.substring(1))));
      } //else
      //javax.swing.JOptionPane.showMessageDialog(null, "Command "+event.getActionCommand());
    } catch (URISyntaxException e) {
      //e.printStackTrace();
    } catch (IOException e) {
View Full Code Here

  public void go2Webpage(String site)
  {
    try
    {
      Desktop desktop = Desktop.getDesktop();
      desktop.browse(new URI(site));
    }
    catch (Exception e)
    {
      logger.error("Failed to go to web site!", e);
    }
View Full Code Here

  public static void browseWebpage(String site)
  {
    try
    {
      Desktop desktop = Desktop.getDesktop();
      desktop.browse(new URI(site));
    }
    catch (Exception e)
    {
      logger.error("Failed to go to web site!", e);
    }
View Full Code Here

  protected void browse(String url) {
    if (Desktop.isDesktopSupported()) {
      Desktop desktop = Desktop.getDesktop();
      if (desktop.isSupported(Action.BROWSE)) {
        try {
          desktop.browse(URI.create(url));
          return;
        } catch (IOException e) {
        }
      }
    }
View Full Code Here

    JMenuItem itemLink = new JMenuItem("Website");
    itemLink.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent ae) {
        try {
          Desktop desktop = Desktop.getDesktop();
          desktop.browse(new URI("http://www.pollux3d.org"));
        } catch (Exception e) {}
      }
    });
    menuAbout.add(itemLink);
  }
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.