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

This code example shows how to use the following methods:getX, getY
This code example shows how to use the following methods:getX, getY
        } 
 
        /* Create the default paper size with a default margin */ 
        Paper paper = new Paper();
 
        int width = (int) (defaultMediaSize.getX(MediaSize.INCH) / (1f / 72f));
        int height = (int) (defaultMediaSize.getY(MediaSize.INCH) / (1f / 72f));       
 
        paper.setSize(width, height);
        paper.setImageableArea(DEFAULT_MARGIN, DEFAULT_MARGIN, width - (2 * DEFAULT_MARGIN), height - (2 * DEFAULT_MARGIN));
 
        PageFormat format = new PageFormat();
        format.setPaper(paper);
 
        /* if a default printer is found, validate the page */ 
        PrintService[] services = PrinterJob.lookupPrintServices();
        if (services.length != 0) { // no printers found on the system.                     
            format = PrinterJob.getPrinterJob().validatePage(format);
        } 
 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getX, getY, getMediaSizeName
//			MediaSize size=MediaSize.getMediaSizeForName(value); 
//			dimension.setSize(size.getX(MediaSize.MM),size.getX(MediaSize.MM)); 
//		} 
		public Format(String name, MediaSize size) {
			this.name=name;
			this.value=size.getMediaSizeName();
			dimension=new Dimension();
			dimension.setSize(size.getX(MediaSize.MM),size.getY(MediaSize.MM));
		} 
		public String toString() {
			return name;
		} 
		public Dimension getDimension() {
			return dimension;
		} 
		public MediaSizeName getValue() {
			return value;
		} 
		public int getType() { 
			return type;
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getX, getY
		AttributesImpl attributes = new AttributesImpl();
 
		attributes.addAttribute("", "master-name", "master-name", "CDATA",
				"content"); 
 
		String width = mediaSize.getX(Size2DSyntax.MM) + "mm";
		String height = mediaSize.getY(Size2DSyntax.MM) + "mm";
 
		if (orientation.equals(OrientationRequested.LANDSCAPE)
				|| orientation.equals(OrientationRequested.REVERSE_LANDSCAPE)) {
			attributes.addAttribute("", "page-width", "page-width", "CDATA",
					height);
			attributes.addAttribute("", "page-height", "page-height", "CDATA",
					width);
		} else if (orientation.equals(OrientationRequested.PORTRAIT)
				|| orientation.equals(OrientationRequested.REVERSE_PORTRAIT)) {
			attributes.addAttribute("", "page-width", "page-width", "CDATA",
					width);
			attributes.addAttribute("", "page-height", "page-height", "CDATA",
					height);
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getX, getY
	public static MediaSizeName getDefaultMediaSizeName(){
		return MediaSizeName.ISO_A4;
	} 
	public static MediaPrintableArea getDefaultMediaPrintableArea(Size2DSyntax size){
		//MediaSize size=MediaSize.getMediaSizeForName(getDefaultMediaSizeName()); 
		return new MediaPrintableArea(DEFAULT_MARGINS,DEFAULT_MARGINS,size.getX(MediaSize.MM)-2*DEFAULT_MARGINS,size.getY(MediaSize.MM)-2*DEFAULT_MARGINS,MediaSize.MM);
	} 
 
	public static MediaSizeName getDefaultMediaSizeName(PrintService printService){
		if (printService instanceof PDFPrintService) return ExtendedPageFormat.getDefaultMediaSizeName();
		else{ 
			Object attr=printService.getDefaultAttributeValue(Media.class);
			if (attr instanceof MediaSizeName) return (MediaSizeName)attr;
			else return null; 
		} 
	} 
	public static MediaPrintableArea getDefaultMediaPrintableArea(PrintService printService,MediaSizeName mediaSizeName){
		//if (printService instanceof PDFPrintService) return ExtendedPageFormat.getDefaultMediaPrintableArea(); 
		//else return (MediaPrintableArea)printService.getDefaultAttributeValue(MediaPrintableArea.class); 
		MediaSize size=MediaSize.getMediaSizeForName(mediaSizeName==null?getDefaultMediaSizeName():mediaSizeName);
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
See Code Examples for Java 8 Size2DSyntax Methods: