本文整理汇总了Java中javax.print.attribute.standard.MediaPrintableArea.INCH属性的典型用法代码示例。如果您正苦于以下问题:Java MediaPrintableArea.INCH属性的具体用法?Java MediaPrintableArea.INCH怎么用?Java MediaPrintableArea.INCH使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.print.attribute.standard.MediaPrintableArea
的用法示例。
在下文中一共展示了MediaPrintableArea.INCH属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDefaultPrintableArea
protected MediaPrintableArea getDefaultPrintableArea(PageFormat page,
double w, double h) {
double ix, iw, iy, ih;
if (w >= 72.0 * 6.0) {
ix = 72.0;
iw = w - 2 * 72.0;
} else {
ix = w / 6.0;
iw = w * 0.75;
}
if (h >= 72.0 * 6.0) {
iy = 72.0;
ih = h - 2 * 72.0;
} else {
iy = h / 6.0;
ih = h * 0.75;
}
return new MediaPrintableArea((float) (ix / DPI), (float) (iy / DPI),
(float) (iw / DPI), (float) (ih / DPI), MediaPrintableArea.INCH);
}
示例2: getDefaultPrintableArea
protected MediaPrintableArea getDefaultPrintableArea(PageFormat page,
double w, double h) {
double ix, iw, iy, ih;
if (w >= 72.0 * 6.0) {
ix = 72.0;
iw = w - 2 * 72.0;
} else {
ix = w / 6.0;
iw = w * 0.75;
}
if (h >= 72.0 * 6.0) {
iy = 72.0;
ih = h - 2 * 72.0;
} else {
iy = h / 6.0;
ih = h * 0.75;
}
return new MediaPrintableArea((float) (ix / DPI), (float) (iy / DPI),
(float) (iw / DPI), (float) (ih / DPI), MediaPrintableArea.INCH);
}
示例3: isSupportedMediaPrintableArea
private boolean isSupportedMediaPrintableArea(MediaPrintableArea mpa) {
getMediaPrintables(null);
int units = MediaPrintableArea.INCH;
if (mediaPrintables != null) {
for (int i=0; i<mediaPrintables.length; i++) {
if ((mpa.getX(units) >= mediaPrintables[i].getX(units)) &&
(mpa.getY(units) >= mediaPrintables[i].getY(units)) &&
(mpa.getX(units) + mpa.getWidth(units) <=
mediaPrintables[i].getX(units) +
mediaPrintables[i].getWidth(units)) &&
(mpa.getY(units) + mpa.getHeight(units) <=
mediaPrintables[i].getY(units) +
mediaPrintables[i].getHeight(units))) {
return true;
}
}
}
return false;
}
示例4: getDefaultPrintableArea
@Override
protected MediaPrintableArea getDefaultPrintableArea(PageFormat page, double w, double h) {
final float dpi = 72.0f;
Paper paper = page.getPaper();
return new MediaPrintableArea(
(float) (paper.getImageableX() / dpi),
(float) (paper.getImageableY() / dpi),
(float) (paper.getImageableWidth() / dpi),
(float) (paper.getImageableHeight() / dpi),
MediaPrintableArea.INCH);
}
示例5: getMediaPrintableArea
/**
* Get Printable Media Area
* @return Printable Area
*/
public MediaPrintableArea getMediaPrintableArea()
{
MediaPrintableArea area = new MediaPrintableArea ((float)getImageableX()/72, (float)getImageableY()/72,
(float)getImageableWidth()/72, (float)getImageableHeight()/72, MediaPrintableArea.INCH);
// log.debug( "CPaper.getMediaPrintableArea", area.toString(MediaPrintableArea.INCH, "\""));
return area;
}
示例6: setMediaPrintableArea
/**
* Get Printable Media Area
* @param area Printable Area
*/
public void setMediaPrintableArea (MediaPrintableArea area)
{
int inch = MediaPrintableArea.INCH;
log.debug(area.toString(inch, "\""));
setImageableArea(area.getX(inch)*72, area.getY(inch)*72,
area.getWidth(inch)*72, area.getHeight(inch)*72);
}