Examples of Desktop


Examples of java.awt.Desktop

        } else if (ae.getSource().equals(mi_game_play)) {
            setGameBeingPlayed(true);
        } 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

Examples of java.awt.Desktop

  private void addPrintMenuItem() {
    if (!Desktop.isDesktopSupported()) {
      return;
    }

    final Desktop desktop = Desktop.getDesktop();
    if (!desktop.isSupported(Desktop.Action.PRINT)) {
      return;
    }

    JButton btnPrint = new JButton(Translator.tr("Print this file"));
    btnPrint.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent ev) {
        try {
          desktop.print(logWindow.getFile());
        } catch (IOException e) {
          logger.warning(e.getMessage());
        }
      }
    });
View Full Code Here

Examples of java.awt.Desktop

            String href = null;
            if (tagA!=null){
              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

Examples of java.awt.Desktop

      } else {
        boolean opened = false;
        // 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

Examples of java.awt.Desktop

  private void mail(final Frame parent, final String content, final String title) {
    // Java 6 desktop API
    boolean sent = false;
    if (Desktop.isDesktopSupported()) {
      Desktop desktop = Desktop.getDesktop();
      try {
        URI uriMailTo = new URI("mailto", "?body=" + content + "&subject=" + title, null);
        desktop.mail(uriMailTo);
        sent = true;
      } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
View Full Code Here

Examples of java.awt.Desktop

        s.invoke(null);
        System.exit(0);
      } 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

Examples of java.awt.Desktop

        if (!Desktop.isDesktopSupported()) {
            download(component, object, streamId);
            return;
        }

        Desktop desktop = Desktop.getDesktop();

        if (!desktop.isSupported(Desktop.Action.OPEN)) {
            download(component, object, streamId);
            return;
        }

        File file = null;

        try {
            file = createTempFileFromDocument(object, streamId);
        } catch (Exception e) {
            showError(component, e);
            return;
        }

        try {
            desktop.open(file);
        } catch (Exception e) {
            if (e instanceof IOException) {
                copy(component, file);
            } else {
                showError(component, e);
View Full Code Here

Examples of java.awt.Desktop

        if (!Desktop.isDesktopSupported()) {
            download(component, object, streamId);
            return;
        }

        Desktop desktop = Desktop.getDesktop();

        if (!desktop.isSupported(Desktop.Action.OPEN)) {
            download(component, object, streamId);
            return;
        }

        File file = null;

        try {
            file = createTempFileFromDocument(object, streamId);
        } catch (Exception e) {
            showError(component, e);
            return;
        }

        try {
            desktop.open(file);
        } catch (Exception e) {
            if (e instanceof IOException) {
                copy(component, file);
            } else {
                showError(component, e);
View Full Code Here

Examples of java.awt.Desktop

  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

Examples of java.awt.Desktop

 
  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
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.