Java 8 Desktop - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 Desktop class.

This code example shows how to use the following methods:isSupported, mail
		desktop = Desktop.getDesktop();
	} 
 
	@Override 
	public void send(String to, String subject, String body) {
		if (!desktop.isSupported(Desktop.Action.MAIL)) {
			logger.error("Desktop.Action.MAIL not supported"); 
			throw new RuntimeException("Desktop.Action.MAIL not supported");
		} 
 
		try { 
			URI uri = new URI(scheme, MessageFormat.format(pattern, to, subject, body), null);
			logger.debug(uri.toString());
			desktop.mail(uri);
		} catch (Exception e) {
			logger.error("Failed to send email to " + to, e.getMessage());
			throw new RuntimeException(e);
		} 
	} 
 
5
CodeRank
This code example shows how to use the following methods:browse
	} 
    } 
     
    public void show(URL url) {
	try { 
	    desktop.browse(url.toURI());
	} catch(Exception e) {
	    throw(new BrowserException(e));
	} 
    } 
} 
4
CodeRank
This code example shows how to use the following methods:open
    } 
 
    public static void startAssociatedProgramFromDesktop(final Desktop desktop, File file) {
        if (file != null && file.canRead()) {
            try { 
                desktop.open(file);
            } catch (IOException e1) {
                LOGGER.error("Cannot open {} with the default system application", file.getName()); //$NON-NLS-1$
            } 
        } 
    } 
 
    @Override 
    public void removeSeries(MediaSeries<MediaElement<?>> sequence) {
 
    } 
 
    @Override 
    public JMenu fillSelectedPluginMenu(JMenu menu) {
        return null; 
4
CodeRank
This code example shows how to use the following methods:browse
            uri = new URI( netSite );
        } catch ( URISyntaxException ex ){
            ex.printStackTrace();
        } 
        try{ 
            desktop.browse( uri );
        } catch ( IOException ex ){
            ex.printStackTrace();
        } 
    } 
 
} 
 
3
CodeRank
See Code Examples for Java 8 Desktop Methods: