Package java.awt

Examples of java.awt.Desktop


  }

  public static void openInBrowser(String url) {
    try {
      java.net.URI uri = new java.net.URI(url);
      Desktop desktop = Desktop.getDesktop();
      desktop.browse(uri);
    } catch (IOException e) {
      e.printStackTrace();
    } catch (URISyntaxException e) {
      e.printStackTrace();
    }
View Full Code Here


        return item;
    }
    protected void showUrl(URL dest) {


        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()) {
            Logger.getLogger(App.class.getName()).log(Level.INFO, "Getting Desktop");
            desktop = Desktop.getDesktop();
            try {
                Logger.getLogger(App.class.getName()).log(Level.INFO, "Browse Command");
                desktop.browse(dest.toURI());
                Logger.getLogger(App.class.getName()).log(Level.INFO, "showURl Complete");
            } catch (Exception ex) {
                JOptionPane.showMessageDialog(null,
                "Exception: " + ex.getMessage());
            }
View Full Code Here

            @Override
            public void mouseClicked(MouseEvent me) {

                if (Desktop.isDesktopSupported()) {
                    Desktop desktop = Desktop.getDesktop();
                    try {
                        desktop.browse(new URI(strURL));
                    } catch (IOException e1) {
                        e1.printStackTrace();
                    } catch (URISyntaxException e1) {
                        e1.printStackTrace();
                    }
View Full Code Here

    return text;
  }
 
  public static void open(URI uri) {
        if (Desktop.isDesktopSupported()) {
                Desktop desktop = Desktop.getDesktop();
                try {
                        desktop.browse(uri);
                } catch (IOException e) {
                JOptionPane.showMessageDialog(null,
                    "Failed to launch the link, " +
                    "your computer is likely misconfigured.",
                    "Cannot Launch Link",JOptionPane.WARNING_MESSAGE);
View Full Code Here

            System.out.println("Pdf Generation success");
            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


    private MenuItem createMenuItem(final String label, final String uriString) {
        MenuItem entry = new MenuItem(label);
        if (Desktop.isDesktopSupported()) {
            final Desktop desktop = Desktop.getDesktop();
            if(desktop.isSupported(Desktop.Action.BROWSE)) {
                ActionListener adminBrowserListener = new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        try {
                            URI uri = new URI(uriString);
                            desktop.browse(uri);

                        } catch (IOException e1) {
                            log.error("SYSTRAY: could not access system browser, access to "+label+" disabled");
                        } catch (URISyntaxException e1) {
                            log.error("SYSTRAY: could not build URI to administration service, access to "+label+" disabled");
View Full Code Here

                        storeStartupProperties(startupProperties);
                    }


                    final Desktop desktop = Desktop.getDesktop();
                    if(desktop.isSupported(Desktop.Action.BROWSE) && serverName != null && serverPort > 0) {
                        try {


                            URI uri = new URI("http",null,serverName,serverPort,"/",null,null);
                            desktop.browse(uri);

                        } catch (Exception e1) {
                            System.err.println("could not open browser window, message was: "+e1.getMessage());
                        }
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

                } else if (count == 2
                    && feedListView.getItemAt(y) == index) {
                    Element itemElement = (Element)feedListView.getListData().get(index);

                    String link = XML.getText(itemElement, "link");
                    Desktop desktop = Desktop.getDesktop();

                    try {
                        desktop.browse(new URL(link).toURI());
                    } catch(MalformedURLException exception) {
                        throw new RuntimeException(exception);
                    } catch(URISyntaxException exception) {
                        throw new RuntimeException(exception);
                    } catch(IOException exception) {
View Full Code Here

                        storeStartupProperties(startupProperties);
                    }


                    final Desktop desktop = Desktop.getDesktop();
                    if(desktop.isSupported(Desktop.Action.BROWSE) && serverName != null && serverPort > 0) {
                        try {


                            URI uri = new URI("http",null,serverName,serverPort,"/",null,null);
                            desktop.browse(uri);

                        } catch (Exception e1) {
                            System.err.println("could not open browser window, message was: "+e1.getMessage());
                        }
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.