Package java.awt

Examples of java.awt.Desktop.open()


        } catch (Exception e) {
            showError(component, e);
        }

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


                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);
            } finally {
View Full Code Here

            try
            {
                if (Desktop.isDesktopSupported())
                {
                    desktop = Desktop.getDesktop();
                    desktop.open(f);
                }
            }
            catch (IOException e)
            {
                log += System.err.toString();
View Full Code Here

            try
            {
                if (Desktop.isDesktopSupported())
                {
                    desktop = Desktop.getDesktop();
                    desktop.open(f);
                }
            }
            catch (IOException e)
            {
                log += System.err.toString();
View Full Code Here

            AbstractAction openFileAction = new AbstractAction("Show in files") {
                @Override
                public void actionPerformed(ActionEvent event) {
                    try {
                        desktop.open(reportFile.getParentFile());
                    } catch (IOException e) {
                        throw new IllegalStateException("Failed showing reportFile (" + reportFile
                                + ") in file explorer.", e);
                    }
                    finishDialog();
View Full Code Here

               return;
            } else if (split[1].equalsIgnoreCase("folder") || split[1].equalsIgnoreCase("dir")) {
               if (Desktop.isDesktopSupported()) {
                  try {
                     Desktop d = Desktop.getDesktop();
                     d.open(macrodir);
                  } catch (Exception e) {
                     sendError(ERRMSG_OSNOTSUPPORTED);
                  }
               } else {
                  sendError(ERRMSG_OSNOTSUPPORTED);
View Full Code Here

            File file = new File(".\\allmatches.pdf");
    if (file.toString().endsWith(".pdf"))
        Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + file);
    else {
        Desktop desktop = Desktop.getDesktop();
        desktop.open(file);
}
           
         
          
           
View Full Code Here

      for (Resource<?> resource : dirs)
      {
         if (resource instanceof FileResource<?>)
         {
            Desktop dt = Desktop.getDesktop();
            dt.open((File) resource.getUnderlyingResourceObject());
         }
         else if (resource instanceof URLResource)
         {
            Desktop dt = Desktop.getDesktop();
            try
View Full Code Here

        Desktop desktop = Desktop.getDesktop();
        for (String path : locations) {
            File folder = new File(path);
            if (folder.exists() && folder.isDirectory()) {
                try {
                    desktop.open(folder);
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
View Full Code Here

            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

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.