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


Java Size2DSyntax.INCH属性代码示例

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


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

示例1: setMediaSize

/**
 * Set Media Size
 * @param x the value to which to set this <code>Paper</code> object's width
 * @param y the value to which to set this <code>Paper</code> object's height
 * @param units number of microns (see Size2DSyntax.INCH, Size2DSyntax.MM)
 * @param landscape true if it's landscape format
 * @see Paper#setSize(double, double)
 */
public void setMediaSize (double x, double y, int units, boolean landscape)
{
	if (x == 0 || y == 0)
		throw new IllegalArgumentException("MediaSize is null");
	
	m_landscape = landscape;

	//	Get Sise in Inch * 72
	final double mult = (double)units / (double)Size2DSyntax.INCH * (double)72;
	final double width = x * mult;
	final double height = y * mult;
	//	Set Size
	setSize (width, height);
	log.debug("Width & Height" + ": " + x + "/" + y  + " - Landscape=" + m_landscape);
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:23,代码来源:CPaper.java

示例2: mapMedia

public static MediaSizeName mapMedia(MediaType mType) {
    MediaSizeName media = null;

    // JAVAXSIZES.length and SIZES.length must be equal!
    // Attempt to recover by getting the smaller size.
    int length = Math.min(SIZES.length, JAVAXSIZES.length);

    for (int i=0; i < length; i++) {
        if (SIZES[i] == mType) {
            if ((JAVAXSIZES[i] != null) &&
                MediaSize.getMediaSizeForName(JAVAXSIZES[i]) != null) {
                media = JAVAXSIZES[i];
                break;
            } else {
                /* create Custom Media */
                media = new CustomMediaSizeName(SIZES[i].toString());

                float w = (float)Math.rint(WIDTHS[i]  / 72.0);
                float h = (float)Math.rint(LENGTHS[i] / 72.0);
                if (w > 0.0 && h > 0.0) {
                    // add new created MediaSize to our static map
                    // so it will be found when we call findMedia
                    new MediaSize(w, h, Size2DSyntax.INCH, media);
                }

                break;
            }
        }
    }
    return media;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:31,代码来源:PrintJob2D.java

示例3: getUnitsInt

/**
 * 	Get Units Int
 *	@return units
 */
public int getUnitsInt()
{
	String du = getDimensionUnits();
	if (du == null || DIMENSIONUNITS_MM.equals(du))
		return Size2DSyntax.MM;
	else if (DIMENSIONUNITS_Inch.equals(du))
		return Size2DSyntax.INCH; 
	else
		throw new AdempiereException("@[email protected] @[email protected] : "+du);
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:14,代码来源:MPrintPaper.java

示例4: PPDMediaSizeName

protected PPDMediaSizeName(int value, float x, float y) {
    super(value);
    if (x > y) {
        float z = x;
        y = x;
        x = z;
    }
    new MediaSize(x / 72, y / 72, Size2DSyntax.INCH, this);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:9,代码来源:PPDMediaSizeName.java


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