本文整理汇总了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);
}
示例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;
}
示例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);
}
示例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);
}