Package java.awt

Examples of java.awt.Desktop


        // 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



    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

      return result;
   }

   private void editResource(UIExecutionContext context, Resource<?> resource) throws IOException
   {
      Desktop dt = Desktop.getDesktop();
      FileResource<?> fileResource = resource.reify(FileResource.class);
      if (fileResource != null && !fileResource.isDirectory())
      {
         dt.edit(fileResource.getUnderlyingResourceObject());
      }
      else
      {
         UIOutput output = context.getUIContext().getProvider().getOutput();
         output.warn(output.err(), "Cannot edit [" + resource.getFullyQualifiedName() + "].");
View Full Code Here

   
    // Listener triggered when the email button is pressed
    @SuppressWarnings("unused")
  private void emailNote() {
        if (Desktop.isDesktopSupported()) {
            Desktop desktop = Desktop.getDesktop();
           
            String text2 = browser.getContentsToEmail();
            QUrl url = new QUrl("mailto:");
            url.addQueryItem("subject", browser.getTitle());
            url.addQueryItem("body", text2);
View Full Code Here

    @SuppressWarnings("unused")
  private void emailNote() {
      logger.log(logger.HIGH, "Entering NeverNote.emailNote");
     
        if (Desktop.isDesktopSupported()) {
            Desktop desktop = Desktop.getDesktop();
           
            String text2 = browserWindow.getContentsToEmail();
            QUrl url = new QUrl("mailto:");
            url.addQueryItem("subject", currentNote.getTitle());
//            url.addQueryItem("body", QUrl.toPercentEncoding(text2).toString());
View Full Code Here

        if (false == Desktop.isDesktopSupported()) {
            _logger.warning("desktop not supported");
            return;
        }
        Desktop desktop = Desktop.getDesktop();
        if (false == desktop.isSupported(Desktop.Action.BROWSE)) {
            _logger.warning("desktop browse not supported");
            return;
        }

        File tmpFile;
        String samlMessage = this.samlModel.getDecodedSAMLMessage(id);
        try {
            tmpFile = File.createTempFile("saml-", ".xml");
            tmpFile.deleteOnExit();
            FileWriter fileWriter = new FileWriter(tmpFile);
            fileWriter.write(samlMessage);
            fileWriter.flush();
            fileWriter.close();
            desktop.browse(tmpFile.toURI());
        } catch (IOException ioe) {
            _logger.warning("Error writing SAML message to file: " + ioe);
        }
    }
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);
               }
               return;
            } else if (split.length < 3) {
               sendError(ERRMSG_PARAM);
               return;
            }
            String filename = join(split, 2, split.length);
            File macro = new File(macrodir, filename + ".txt");
            if (split[1].equalsIgnoreCase("delete")) {
               if (macro.exists() && macro.isFile()) {
                  try {
                     macro.delete();
                     sendMessage("Macro successfully deleted");
                  } catch (Exception e) {
                     sendError("Could not delete specified macro " + filename);
                  }
               } else {
                  sendError("Could not delete specified macro " + filename);
               }
               return;
            } else if (split[1].equalsIgnoreCase("engine")) {
               ScriptEngineManager engineMgr = new ScriptEngineManager();
               ScriptEngine engine = engineMgr.getEngineByName(filename);
               if (engine == null) {
                  sendError("Specified language engine could not be loaded.");
                  return;
               }
               this.engine = filename;
               saveSettings();
               sendMessage("Script engine changed to " + filename);
               return;
            }
            if (!macro.exists()) {
               try {
                  macro.createNewFile();
               } catch (Exception e) {
                  sendError("Could not open the macro for editing");
               }
            }
            if (Desktop.isDesktopSupported()) {
               try {
                  Desktop d = Desktop.getDesktop();
                  d.edit(macro);
               } catch (Exception e) {
                  sendError(ERRMSG_OSNOTSUPPORTED);
               }
            } else {
               sendError(ERRMSG_OSNOTSUPPORTED);
View Full Code Here

            ph.mc.sndManager.playSoundFX("spcfools",1.0F,1.0F);
            return true;
         }
         if (args.length == 2 && (args[0].equalsIgnoreCase("help") || args[0].equalsIgnoreCase("/help")) && args[1].equalsIgnoreCase("roll")) {
            if (Desktop.isDesktopSupported()) {
               Desktop d = Desktop.getDesktop();
               try {
                  d.browse( new URI("http://www.youtube.com/watch?v=oHg5SJYRHA0") );
               } catch (Exception e) {
                  e.printStackTrace();
               }
            }
         }
View Full Code Here

    }
  }
 
  public static void openWebSite(String url) throws IOException{
    if(!Desktop.isDesktopSupported()) return;
    Desktop desktop = Desktop.getDesktop();
    if(!desktop.isSupported(Desktop.Action.BROWSE))return;
    desktop.browse(URI.create(url));
  }
View Full Code Here

    }
  }

  private void launchBrowser() {
    try {
      Desktop deskTop = Desktop.getDesktop();
      deskTop.browse(new URI(rb.getString("help.url")));
    } catch (Exception ex) {
      Dialogs.showError(rb.getString("error.title"), ex.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.