Examples of Desktop


Examples of java.awt.Desktop

   *            The URL to open
   * @throws Exception
   *             If an error occurs attempting to open the url
   */
  public static void openURL(final URL url) throws Exception {
    final Desktop desktop = Desktop.isDesktopSupported() ? Desktop
        .getDesktop() : null;
    if ((desktop != null) && desktop.isSupported(Desktop.Action.BROWSE)) {
      desktop.browse(url.toURI());
    } else {
      final OperatingSystem system = Utils.getPlatform();
      switch (system) {
      case MAC:
        Class.forName("com.apple.eio.FileManager")
View Full Code Here

Examples of java.awt.Desktop

   *            The file to open.
   * @throws Exception
   *             if the file could not be opened.
   */
  public static void openFile(final File file) throws Exception {
    final Desktop desktop = Desktop.isDesktopSupported() ? Desktop
        .getDesktop() : null;
        if ((desktop != null) && desktop.isSupported(Desktop.Action.OPEN)) {
          desktop.open(file);
        } else {
          final OperatingSystem system = Utils.getPlatform();
          switch (system) {
          case MAC:
          case WINDOWS:
View Full Code Here

Examples of java.awt.Desktop

   *            The URL to open
   * @throws Exception
   *             If an error occurs attempting to open the url
   */
  public static void openURL(final URL url) throws Exception {
    final Desktop desktop = Desktop.isDesktopSupported() ? Desktop
        .getDesktop() : null;
    if ((desktop != null) && desktop.isSupported(Desktop.Action.BROWSE)) {
      desktop.browse(url.toURI());
    } else {
      final OperatingSystem system = Utils.getPlatform();
      switch (system) {
      case MAC:
        Class.forName("com.apple.eio.FileManager")
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(ligne.toLowerCase().matches("url.*")){
                           
                ligne = ligne.substring(4, ligne.length());
                //System.out.println(ligne);
                Desktop Bureau = Desktop.getDesktop();
                URI url = new URI(ligne);
                                Bureau.browse(url);
        }
                }
               
                br.close();
        }              
View Full Code Here

Examples of java.awt.Desktop

  }

  void printOpen(String fileLoc) {
    // not compatible in JRE 1.5
   
           Desktop desktop = null;
           // Before more Desktop API is used, first check
           // whether the API is supported by this particular
           // virtual machine (VM) on this particular host.
           if (Desktop.isDesktopSupported()) {
               desktop = Desktop.getDesktop();
               File file = new File(fileLoc);
               try {
            desktop.open(file);
          } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          }
           }
View Full Code Here

Examples of java.awt.Desktop

                        tempReportFile.deleteOnExit();
                        report.createReport(parameters, groups, tempReportFile);

                        // show report
                        Desktop desktop = Desktop.getDesktop();
                        if (!desktop.isSupported(Desktop.Action.OPEN)) {
                            JOptionPane.showMessageDialog(owner, "Report: " + tempReportFile.getAbsolutePath(),
                                    "Report", JOptionPane.INFORMATION_MESSAGE);
                        } else {
                            desktop.open(tempReportFile);
                        }
                    } catch (Exception e) {
                        JOptionPane.showMessageDialog(owner, "Error: " + e.getMessage(), "Report Error",
                                JOptionPane.ERROR_MESSAGE);
                    }
View Full Code Here

Examples of java.awt.Desktop

    URI authUrl = new URI(url);

    if(Desktop.isDesktopSupported())
    {
      Desktop desktop = Desktop.getDesktop();

      if(desktop.isSupported(Desktop.Action.BROWSE))
      {
        desktop.browse(authUrl);
      }
      else
      {
        JOptionPane.showMessageDialog(null, "Visit the following URL: " + authUrl);
      }
View Full Code Here

Examples of java.awt.Desktop

        {
          URI websiteUri = new URI(websiteUrl);

          if(Desktop.isDesktopSupported())
          {
            Desktop desktop = Desktop.getDesktop();

            if(desktop.isSupported(Desktop.Action.BROWSE))
            {
              desktop.browse(websiteUri);
            }
            else
            {
              JOptionPane.showMessageDialog(null, websiteUrl);
            }
View Full Code Here

Examples of java.awt.Desktop

            if (!GfrOptionPaneAbs.s_showDialogConfirm(frmOwner, "Done : Export image gallery to folder", strBody))
               return;

            try
            {
               Desktop desktop = Desktop.getDesktop();
               desktop.open(fleFolderOut);
            }
            catch (Exception exc)
            {
               exc.printStackTrace();
               GfrOptionPaneAbs.s_showDialogError(frmOwner, "failed to launch default file manager");
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.