当前位置: 首页>>代码示例>>Java>>正文


Java Paper.getImageableHeight方法代码示例

本文整理汇总了Java中java.awt.print.Paper.getImageableHeight方法的典型用法代码示例。如果您正苦于以下问题:Java Paper.getImageableHeight方法的具体用法?Java Paper.getImageableHeight怎么用?Java Paper.getImageableHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.print.Paper的用法示例。


在下文中一共展示了Paper.getImageableHeight方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testGetPageFormat

import java.awt.print.Paper; //导入方法依赖的package包/类
public void testGetPageFormat() {
    PrinterJob pj = PrinterJob.getPrinterJob();
    PageFormat expResult = PrintPreferences.getPageFormat(pj);
    PrintPreferences.setPageFormat(expResult);
    PageFormat result = PrintPreferences.getPageFormat(pj);
    assertEquals(expResult.getHeight(), result.getHeight());
    assertEquals(expResult.getWidth(), result.getWidth());
    assertEquals(expResult.getOrientation(), result.getOrientation());
    assertEquals(expResult.getPaper().getHeight(), result.getPaper().getHeight());
    assertEquals(expResult.getPaper().getWidth(), result.getPaper().getWidth());
    assertEquals(expResult.getPaper().getImageableHeight(), result.getPaper().getImageableHeight());
    assertEquals(expResult.getPaper().getImageableWidth(), result.getPaper().getImageableWidth());
    assertEquals(expResult.getPaper().getImageableX(), result.getPaper().getImageableX());
    assertEquals(expResult.getPaper().getImageableY(), result.getPaper().getImageableY());
    
    double w = expResult.getPaper().getWidth() + 10;
    double h = expResult.getPaper().getHeight() + 10;
    Paper p = expResult.getPaper();
    double ix = p.getImageableX() + 10;
    double iy = p.getImageableY() + 10;
    double iw = p.getImageableWidth() + 10;
    double ih = p.getImageableHeight() + 10;
    p.setImageableArea(ix, iy, iw, ih);
    p.setSize(w, h);
    expResult.setPaper(p);
    PrintPreferences.setPageFormat(expResult);
    assertEquals(h, PrintPreferences.getPageFormat(pj).getHeight());
    assertEquals(w, PrintPreferences.getPageFormat(pj).getWidth());
    assertEquals(ix, PrintPreferences.getPageFormat(pj).getPaper().getImageableX());
    assertEquals(iy, PrintPreferences.getPageFormat(pj).getPaper().getImageableY());
    assertEquals(iw, PrintPreferences.getPageFormat(pj).getPaper().getImageableWidth());
    assertEquals(ih, PrintPreferences.getPageFormat(pj).getPaper().getImageableHeight());
    
    expResult.setOrientation(PageFormat.REVERSE_LANDSCAPE);
    PrintPreferences.setPageFormat(expResult);
    assertEquals(PageFormat.REVERSE_LANDSCAPE, PrintPreferences.getPageFormat(pj).getOrientation());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:38,代码来源:PrintPreferencesTest.java

示例2: updateController

import java.awt.print.Paper; //导入方法依赖的package包/类
/**
 * Updates controller print attributes.
 */
public void updateController(PageSetupController controller)
{
	// Return an HomePrint instance matching returnedPageFormat
	HomePrint.PaperOrientation paperOrientation;
	switch (this.pageFormat.getOrientation())
	{
		case PageFormat.LANDSCAPE:
			paperOrientation = HomePrint.PaperOrientation.LANDSCAPE;
			break;
		case PageFormat.REVERSE_LANDSCAPE:
			paperOrientation = HomePrint.PaperOrientation.REVERSE_LANDSCAPE;
			break;
		default:
			paperOrientation = HomePrint.PaperOrientation.PORTRAIT;
			break;
	}
	Paper paper = this.pageFormat.getPaper();
	HomePrint homePrint = new HomePrint(paperOrientation, (float) paper.getWidth(), (float) paper.getHeight(),
			(float) paper.getImageableY(), (float) paper.getImageableX(),
			(float) (paper.getHeight() - paper.getImageableHeight() - paper.getImageableY()),
			(float) (paper.getWidth() - paper.getImageableWidth() - paper.getImageableX()),
			this.furniturePrintedCheckBox.isSelected(), this.planPrintedCheckBox.isSelected(),
			this.view3DPrintedCheckBox.isSelected(),
			this.userPlanScaleRadioButton.isSelected() && this.userPlanScaleSpinner.getValue() != null
					? 1f / ((Number) this.userPlanScaleSpinner.getValue()).intValue() : null,
			this.headerFormatTextField.getText().trim(), this.footerFormatTextField.getText().trim());
	controller.setPrint(homePrint);
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:32,代码来源:PageSetupPanel.java

示例3: getPageFormatAsString

import java.awt.print.Paper; //导入方法依赖的package包/类
/**
 * @param pPageFormat
 * @return
 */
public static String getPageFormatAsString(Paper pPaper) {
	return pPaper.getWidth() + ";" + pPaper.getHeight() + ";"
			+ pPaper.getImageableX() + ";" + pPaper.getImageableY() + ";"
			+ pPaper.getImageableWidth() + ";"
			+ pPaper.getImageableHeight();
}
 
开发者ID:iwabuchiken,项目名称:freemind_1.0.0_20140624_214725,代码行数:11,代码来源:Tools.java

示例4: validatePaper

import java.awt.print.Paper; //导入方法依赖的package包/类
/**
 * updates a Paper object to reflect the current printer's selected
 * paper size and imageable area for that paper size.
 * Default implementation copies settings from the original, applies
 * applies some validity checks, changes them only if they are
 * clearly unreasonable, then sets them into the new Paper.
 * Subclasses are expected to override this method to make more
 * informed decisons.
 */
protected void validatePaper(Paper origPaper, Paper newPaper) {
    if (origPaper == null || newPaper == null) {
        return;
    } else {
        double wid = origPaper.getWidth();
        double hgt = origPaper.getHeight();
        double ix = origPaper.getImageableX();
        double iy = origPaper.getImageableY();
        double iw = origPaper.getImageableWidth();
        double ih = origPaper.getImageableHeight();

        /* Assume any +ve values are legal. Overall paper dimensions
         * take precedence. Make sure imageable area fits on the paper.
         */
        Paper defaultPaper = new Paper();
        wid = ((wid > 0.0) ? wid : defaultPaper.getWidth());
        hgt = ((hgt > 0.0) ? hgt : defaultPaper.getHeight());
        ix = ((ix > 0.0) ? ix : defaultPaper.getImageableX());
        iy = ((iy > 0.0) ? iy : defaultPaper.getImageableY());
        iw = ((iw > 0.0) ? iw : defaultPaper.getImageableWidth());
        ih = ((ih > 0.0) ? ih : defaultPaper.getImageableHeight());
        /* full width/height is not likely to be imageable, but since we
         * don't know the limits we have to allow it
         */
        if (iw > wid) {
            iw = wid;
        }
        if (ih > hgt) {
            ih = hgt;
        }
        if ((ix + iw) > wid) {
            ix = wid - iw;
        }
        if ((iy + ih) > hgt) {
            iy = hgt - ih;
        }
        newPaper.setSize(wid, hgt);
        newPaper.setImageableArea(ix, iy, iw, ih);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:50,代码来源:RasterPrinterJob.java

示例5: getPhysicalPrintableHeight

import java.awt.print.Paper; //导入方法依赖的package包/类
protected double getPhysicalPrintableHeight(Paper p) {
    return p.getImageableHeight();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:4,代码来源:PSPrinterJob.java


注:本文中的java.awt.print.Paper.getImageableHeight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。