Package java.awt

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


        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

  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

   *
   * @param url absolute url to open in the browser
   */
  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

    menuBar.add(menuAbout);
    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

      // supported?
      if (!Desktop.isDesktopSupported()) {
        errors.add(I18N.t("Java Desktop Funktion wird vom System nicht untersützt."), Level.INFO_INT);
      }

      final Desktop desktop = Desktop.getDesktop();

      // supported?
      if (!desktop.isSupported(a)) {
        errors.add(I18N.t("{0}-Aktion wird nicht unterstützt.", a), Level.INFO_INT);
      }

      // abort?
      return errors.showOk();
View Full Code Here

            public void mouseExited(MouseEvent arg0) {}
   
            public void mousePressed(MouseEvent arg0) {}
   
            public void mouseReleased(MouseEvent arg0) {
                Desktop desktop = Desktop.getDesktop();
                try {
              desktop.browse(new URI("http://www.pollux3d.org"));
            } catch (Exception e) {}
            }
          });
        }
      } catch (Exception e) {}
View Full Code Here

      // supported?
      if (!Desktop.isDesktopSupported()) {
        errors.add(I18N.t("Java Desktop Funktion wird vom System nicht untersützt."), Priority.INFO_INT);
      }

      final Desktop desktop = Desktop.getDesktop();

      // supported?
      if (!desktop.isSupported(a)) {
        errors.add(I18N.t("{0}-Aktion wird nicht unterstützt.", a), Priority.INFO_INT);
      }

      // abort?
      return errors.showOk();
View Full Code Here

            openFile(zipFilename);
          }

          private void openFile(String zipFilename) {
            if (Desktop.isDesktopSupported()) {
              Desktop dt = Desktop.getDesktop();
              try {
                dt.open(new File(zipFilename));
              }
              catch (Exception ex) {
                ex.printStackTrace();
              }
            }
View Full Code Here

TOP

Related Classes of java.awt.Desktop

Copyright © 2018 www.massapicom. 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.