Java 8 Printable - 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 Printable class.

This code example shows how to use the following methods:getMediaSubtype, getMimeType
 */ 
public class DocFlavorComparator implements Comparator<DocFlavor> {
 
	public int compare(DocFlavor docFlavor1, DocFlavor docFlavor2) {
 
		int comparison = docFlavor1.getMimeType().compareTo(docFlavor2.getMimeType());
 
		if (comparison == 0) {
			return docFlavor1.getMediaSubtype().compareTo(docFlavor2.getMediaSubtype());
		} 
 
		return comparison;
	} 
 
} 
5
CodeRank
This code example shows how to use the following methods:
	public PrintMessageHandler(PrintServiceExecutor printServiceExecutor, String mimeType, String className) {
 
		Assert.hasText(className, "'className' must be neither null nor empty.");
		Assert.hasText(mimeType, "'mimeType' must be neither null nor empty.");
 
		this.docFlavor = new DocFlavor(mimeType, className);
		this.printServiceExecutor = printServiceExecutor;
 
	} 
 
	public PrintMessageHandler(PrintServiceExecutor printServiceExecutor) {
		this.docFlavor = DocFlavor.STRING.TEXT_PLAIN;
		this.printServiceExecutor = printServiceExecutor;
	} 
 
	@Override 
	protected void handleMessageInternal(Message<?> message) throws Exception {
 
		if (LOG.isDebugEnabled()) {
			LOG.debug("Printing using printer '" + this.printServiceExecutor.getPrintService().getName() + "'.");
4
CodeRank
This code example shows how to use the following methods:print
				} 
				if (target instanceof PrintGridable) {
					((PrintGridable) target).setTitleOffset(height);
				} 
			} 
			target.print(g2, format, pageIndex);
		} catch (Exception e) {
			e.printStackTrace();
		} 
	} 
 
	public void update() { 
		try { 
			updateBufferedImage(); 
		} catch (Exception e) {
			e.printStackTrace();
		} catch (OutOfMemoryError e) {
			e.printStackTrace();
		} 
		repaint();
4
CodeRank
This code example shows how to use the following methods:print
 
        // reset the color 
        g2.setPaint(Color.BLACK);
 
        try { 
            printable.print(g2, pageFormat, 0);
        } catch (PrinterException e) {
            Logger.getLogger(PrintPreviewPanel.class.getName()).log(Level.INFO, e.getLocalizedMessage(), e);
        } 
    } 
} 
3
CodeRank
This code example shows how to use the following methods:print
 
        g2d.scale(scale, scale);
        g2d.clip(new Rectangle2D.Double(format.getImageableX(), format.getImageableY(), format.getImageableWidth(), format.getImageableHeight()));
        if (printable != null) {
            try { 
                printable.print(g2d, format, 0);
            } 
            catch (PrinterException e) {
                // should never happen since we are not printing 
            } 
        } 
        else { 
            g2d.setColor(Color.gray);
            g2d.fillRect(0, 0, (int)format.getWidth(), (int)format.getHeight());
        } 
 
        g2d.setTransform(at);
    } 
 
} 
4
CodeRank
See Code Examples for Java 8 Printable Methods: