Package java.awt

Examples of java.awt.Desktop


        launched = true;
      } catch (Exception e) {}
    }
   
    if (!launched) {
      Desktop desktop = getDesktop();
          if (desktop != null) {
              try {
                desktop.browse(url.toURI());
                launched = true;
              } catch (Exception exp) {
                logger.debug("Could not launch URL using the Dekstop class [" + url + "]", exp);
               
                if (!Utilities.isEmpty(browserPath))
View Full Code Here


        String program = null;
        String extension = Utilities.getExtension(file);
        if (definitions != null && !Utilities.isEmpty(extension))
            program = definitions.getProgramForExtension(extension);

        Desktop desktop = getDesktop();
        if (program == null || program.trim().length() == 0) {
            boolean launched = true;
            if (desktop != null) {
                try {
                    desktop.open(file);
                } catch (Exception exp) {
                  logger.debug("Could not launch file using the Dekstop class [" + file + "]", exp);
                    launched = false;
                }
            }
View Full Code Here

    }*/

    @Override
    public void actionPerformed(ActionEvent ev) {
        /*if (Desktop.isDesktopSupported()) {*/
            Desktop desktop = Desktop.getDesktop();
            /*if (desktop.isSupported(Desktop.Action.BROWSE)) {*/
                try {
                    desktop.browse(new URI("http://gephi.org/users/support/"));
                } catch (Exception ex) {
                    Exceptions.printStackTrace(ex);
                }
            /*}
        }*/
 
View Full Code Here

   *            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

   *            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

   *            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

   *            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

        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

                       
                        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

  }

  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

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.