Package java.awt

Examples of java.awt.Desktop



    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


        // Update check:
        new Thread(ServiceLocator.getInstance(AppUpdateRunner.class)).start();
    }
   
    private void openUrl(String url) {
        Desktop dt = Desktop.isDesktopSupported()? Desktop.getDesktop(): null;
        if(dt != null && dt.isSupported(Desktop.Action.BROWSE)) {
            try {
                dt.browse(new URI(url));
            }
            catch (URISyntaxException ex) {
                assert true: "Will never come here!";
            }
            catch(IOException ex) {
View Full Code Here

    private static final String PROP_UPDATE_CHECK_LAST = "update.check.last";
    private static final String PROP_UPDATE_CHECK_ENABLED = "update.check.enabled";
    private static final long TIME_GAP = 604800000l; // 1 week in millis
   
    private void openUrl(String url) {
        Desktop desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null;
        if (desktop != null && desktop.isSupported(Desktop.Action.BROWSE)) {
            try {
                desktop.browse(new URI(url));
            }
            catch(URISyntaxException | IOException ex) {
                LOG.log(Level.INFO, "Error when opening browser", ex);
            }
        }
View Full Code Here

  public static void openURL(String url) throws IOException {

    // Plan A: try to open the URL using the Java 6 Desktop class
    if (Desktop.isDesktopSupported()) {
      Desktop desktop = Desktop.getDesktop();
      if (desktop.isSupported(Desktop.Action.BROWSE)) {
        try {
          desktop.browse(new URI(url));
          return; // success
        } catch (URISyntaxException e) {
          Logger.logError(e);
        }
      }
View Full Code Here

    // ignore
  }

  private void browse() {
    if (Desktop.isDesktopSupported()) {
      Desktop desktop = Desktop.getDesktop();
      if (desktop.isSupported(Action.BROWSE)) {
        try {
          desktop.browse(new java.net.URI(url));
          return;
        } catch (IOException e) {
          LOG.debug("Open url error", e);
        } catch (URISyntaxException e) {
          LOG.debug("Open url error", e);
View Full Code Here

    public void actionPerformed(ActionEvent e) {
      // TODO Auto-generated method stub
      // ouvrir le site web sur le navigateur par d�faut
            if ( Desktop.isDesktopSupported() ) {
              // On r�cup�re l'instance du desktop :
              Desktop desktop = Desktop.getDesktop();
             
              // On v�rifie que la fonction browse est bien support�e :
              if (desktop.isSupported(Desktop.Action.BROWSE)) {
               
                // Et on lance l'application associ� au protocole :
                try {
                  desktop.browse(new URI("http://www.wallcat-lejeu.com"));
                } catch (IOException e1) {
                  // TODO Auto-generated catch block
                  erreurOuvertureBrower();
                } catch (URISyntaxException e1) {
                  // TODO Auto-generated catch block
View Full Code Here

  @Override
  public void startSystemApplicationForUrl(URL url)
  {
    if (Desktop.isDesktopSupported())
    {
      Desktop desktop = Desktop.getDesktop();
      try
      {
        desktop.browse(url.toURI());
      }
      catch (IOException e)
      {
        Activator
            .getPluginContext()
View Full Code Here

      ResourceConfig config = new ResourceConfig(DependencyRestService.class);
      HttpServer server = this.startServer( config ) ;

      if (Desktop.isDesktopSupported())
      {
        Desktop desktop=Desktop.getDesktop();


        File tempDir = com.google.common.io.Files.createTempDir();
        tempDir.deleteOnExit();

        this.transferResourceToTmp( "clashInspectorStyle", "css",tempDir,false );
        this.transferResourceToTmp( "jquery-1.11.0", "js",tempDir ,false);
        this.transferResourceToTmp( "main", "js",tempDir,true );
        this.transferResourceToTmp( "openDepNode", "png",tempDir,false );
        this.transferResourceToTmp( "openDepNode_hasWinner", "png",tempDir,false );
        this.transferResourceToTmp( "clashinspectorLogo", "jpg",tempDir,false );
        this.transferResourceToTmp( "fhReutlingenLogo", "jpg",tempDir,false );
        this.transferResourceToTmp( "legendArrowHasDependencies", "png",tempDir,false );
        this.transferResourceToTmp( "legendArrowHasUnsafeDependencies", "png",tempDir,false );
        this.transferResourceToTmp( "legendArrowHasCriticalDependencies", "png",tempDir,false );
        this.transferResourceToTmp( "legendArrowHasUnresolvedDependencies", "png",tempDir,false );
        this.transferResourceToTmp( "legendScopes_long", "png",tempDir,false );
        this.transferResourceToTmp( "legendOptional", "png",tempDir,false );




        desktop.browse(this.transferResourceToTmp( "clashInspector", "html",tempDir,false ));
      }
      else
      {
        super.getLog().warn( "Couldn't open File with default-browser. Please open file manually under: " + System.getProperty("java.io.tmpdir")+"clashInspector.html" );
      }
View Full Code Here

      HttpServer server = JdkHttpServerFactory.createHttpServer(new URI( "http://localhost:"+port+"/"), config );


      if (Desktop.isDesktopSupported())
      {
        Desktop desktop=Desktop.getDesktop();


        this.transferResourceToTmp( "clashInspectorStyle", "css" );
        this.transferResourceToTmp( "jquery-1.11.0", "js" );
        this.transferResourceToTmp( "main", "js" );
        this.transferResourceToTmp( "openDepNode", "png" );
        this.transferResourceToTmp( "openDepNode_hasWinner", "png" );
        this.transferResourceToTmp( "clashinspectorLogo", "jpg" );
        this.transferResourceToTmp( "fhReutlingenLogo", "jpg" );
        this.transferResourceToTmp( "legendArrowHasDependencies", "png" );
        this.transferResourceToTmp( "legendArrowHasUnsafeDependencies", "png" );
        this.transferResourceToTmp( "legendArrowHasCriticalDependencies", "png" );
        this.transferResourceToTmp( "legendArrowHasUnresolvedDependencies", "png" );
        this.transferResourceToTmp( "legendScopes_long", "png" );
        this.transferResourceToTmp( "legendOptional", "png" );








        desktop.browse(this.transferResourceToTmp( "clashInspector", "html" ));
      }
      else
      {
        super.getLog().warn( "Couldn't open File with default-browser. Please open file manually under: " + System.getProperty("java.io.tmpdir")+"clashInspector.html" );
      }
View Full Code Here

    }
    String url = manager.getAuthenticationUrl(providerId, successURL);
    startServer();

    if (Desktop.isDesktopSupported()) {
      Desktop desktop = Desktop.getDesktop();
      if (desktop.isSupported(Action.BROWSE)) {
        try {
          desktop.browse(URI.create(url));
          // return;
        } catch (IOException e) {
          // handled below
        }
      }
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.