Package java.awt

Examples of java.awt.Desktop


                HtmlReport report = new HtmlReport();
                report.createReport(runner.getParameters(), runner.getGroups(), 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);
            } finally {
View Full Code Here


            respond(response, "{ \"code\" : \"error\", \"message\" : \"Workspace directory can only be opened on the local machine where Google Refine is run.\" }");
        } else if (ProjectManager.singleton instanceof FileProjectManager) {
            File dir = ((FileProjectManager) ProjectManager.singleton).getWorkspaceDir();

            if (Desktop.isDesktopSupported()) {
                Desktop desktop = Desktop.getDesktop();
                desktop.open(dir);
            } else /* if Mac */ {
                Runtime.getRuntime().exec(
                        "open .",
                        new String[] {},
                        dir
View Full Code Here

        // Add a button press listener to open the Yahoo! Finance web page when
        // the link is clicked
        yahooFinanceButton.getButtonPressListeners().add(new ButtonPressListener() {
            @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

     * @param url
     *            the file's url (the url must start with either "http://" or
     *            "file://").
     */
     private void browseURLInSystemBrowser(String url) {
       Desktop desktop = Desktop.getDesktop();
       if( !desktop.isSupported( java.awt.Desktop.Action.BROWSE ) ) {
         progress("Could not open "+url+"\n");
       }
       try {
         java.net.URI uri = new java.net.URI( url );
         desktop.browse( uri );
       }catch ( Exception e ) {
           System.err.println( e.getMessage() );
       }
     }
View Full Code Here

     * @param url
     *            the file's url (the url must start with either "http://" or
     *            "file://").
     */
     private void browseURLInSystemBrowser(String url) {
       Desktop desktop = Desktop.getDesktop();
       if( !desktop.isSupported( java.awt.Desktop.Action.BROWSE ) ) {
         progress("Could not open "+url+"\n");
       }
       try {
         java.net.URI uri = new java.net.URI( url );
         desktop.browse( uri );
       }catch ( Exception e ) {
           System.err.println( e.getMessage() );
       }
     }
View Full Code Here

     * @param url
     *            the file's url (the url must start with either "http://" or
     *            "file://").
     */
     private void browseURLInSystemBrowser(String url) {
       Desktop desktop = Desktop.getDesktop();
       if( !desktop.isSupported( java.awt.Desktop.Action.BROWSE ) ) {
         progress("Could not open "+url+"\n");
       }
       try {
         java.net.URI uri = new java.net.URI( url );
         desktop.browse( uri );
       }catch ( Exception e ) {
           System.err.println( e.getMessage() );
       }
     }
View Full Code Here

     * @param url
     *            the file's url (the url must start with either "http://" or
     *            "file://").
     */
     private void browseURLInSystemBrowser(String url) {
       Desktop desktop = Desktop.getDesktop();
       if( !desktop.isSupported( java.awt.Desktop.Action.BROWSE ) ) {
         progress("Could not open "+url+"\n");
       }
       try {
         java.net.URI uri = new java.net.URI( url );
         desktop.browse( uri );
       }catch ( Exception e ) {
           System.err.println( e.getMessage() );
       }
     }
View Full Code Here

  }

  public static void open(File document) {
    if (!document.exists()) return;
    try {
      Desktop dt = Desktop.getDesktop();
      dt.open(document);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here

  private static final long  serialVersionUID  = -3801443131566852907L;
  private String            url;

  public void mouseClicked(MouseEvent arg0) {
    if (!Desktop.isDesktopSupported()) return;
    Desktop desktop = Desktop.getDesktop();
    if (!desktop.isSupported(java.awt.Desktop.Action.BROWSE)) return;
    try {
      URI uri = new java.net.URI(url);
      desktop.browse(uri);
    } catch (Exception e) {
      System.err.println("Unable to open browser to " + url);
    }
  }
View Full Code Here

   {
      for (Resource<?> resource : dirs)
      {
         if (resource instanceof FileResource<?>)
         {
            Desktop dt = Desktop.getDesktop();
            dt.open((File) resource.getUnderlyingResourceObject());
         }
      }
   }
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.