本文整理汇总了Java中javax.print.attribute.standard.PrinterResolution.getCrossFeedResolution方法的典型用法代码示例。如果您正苦于以下问题:Java PrinterResolution.getCrossFeedResolution方法的具体用法?Java PrinterResolution.getCrossFeedResolution怎么用?Java PrinterResolution.getCrossFeedResolution使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.print.attribute.standard.PrinterResolution
的用法示例。
在下文中一共展示了PrinterResolution.getCrossFeedResolution方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateResolutionTitle
import javax.print.attribute.standard.PrinterResolution; //导入方法依赖的package包/类
private static String generateResolutionTitle(PrinterResolution res) {
StringBuilder buffer = new StringBuilder();
int x = res.getCrossFeedResolution(ResolutionSyntax.DPI);
int y = res.getFeedResolution(ResolutionSyntax.DPI);
buffer.append(Integer.toString(x));
if (x != y) {
buffer.append(" x "); //$NON-NLS-1$
buffer.append(Integer.toString(y));
}
buffer.append(DPI);
return buffer.toString();
}
示例2: createResolutionString
import javax.print.attribute.standard.PrinterResolution; //导入方法依赖的package包/类
private static String createResolutionString(PrinterResolution res) {
if (res != null) {
StringBuilder buffer = new StringBuilder();
int x = res.getCrossFeedResolution(1);
int y = res.getFeedResolution(1);
buffer.append(Integer.toString(x));
if (x != y) {
buffer.append("x"); //$NON-NLS-1$
buffer.append(Integer.toString(y));
}
return buffer.toString();
}
return null;
}
示例3: setResolutionAttrib
import javax.print.attribute.standard.PrinterResolution; //导入方法依赖的package包/类
private void setResolutionAttrib(Attribute attr) {
PrinterResolution pr = (PrinterResolution)attr;
mAttXRes = pr.getCrossFeedResolution(PrinterResolution.DPI);
mAttYRes = pr.getFeedResolution(PrinterResolution.DPI);
}
示例4: convertAttributes
import javax.print.attribute.standard.PrinterResolution; //导入方法依赖的package包/类
int[] convertAttributes(PrintRequestAttributeSet attrs, DocFlavor flavor)
throws PrintException {
PrintRequestAttributeSet attributes = null;
if (attrs == null ||
flavor.equals(DocFlavor.INPUT_STREAM.AUTOSENSE) ||
flavor.equals(DocFlavor.BYTE_ARRAY.AUTOSENSE) ||
flavor.equals(DocFlavor.URL.AUTOSENSE)) {
int[] defaultValues = {-1, -1, -1, -1, -1, -1, -1, -1};
return defaultValues;
} else {
attributes = attrs;
}
Attribute[] requestAttrs = attributes.toArray();
int[] printAttributes = new int[ATTRIBUTES_ARRAY_SIZE];
Arrays.fill(printAttributes, -1);
for (int i = 0; i < requestAttrs.length; i++) {
Class category = requestAttrs[i].getCategory();
if (!isAttributeValueSupported(requestAttrs[i], flavor, attrs)) {
// Do nothing or throw PrintException if Fidelity supported.
} else if (category.equals(Copies.class)) {
Copies copies = (Copies)requestAttrs[i];
printAttributes[COPIES_INDEX] = copies.getValue();
} else if (category.equals(Sides.class)) {
Sides sides = (Sides)requestAttrs[i];
printAttributes[SIDES_INDEX] = 1;
if (sides.equals(Sides.DUPLEX) ||
sides.equals(Sides.TWO_SIDED_LONG_EDGE)) {
printAttributes[SIDES_INDEX] = 2;
} else if (sides.equals(Sides.TUMBLE) ||
sides.equals(Sides.TWO_SIDED_SHORT_EDGE)) {
printAttributes[SIDES_INDEX] = 3;
}
} else if (category.equals(Media.class)) {
if (medias.containsKey(requestAttrs[i])) {
Integer id = (Integer)medias.get(requestAttrs[i]);
printAttributes[PAPER_ID_INDEX] = id.intValue();
}
} else if (category.equals(Chromaticity.class)) {
if (requestAttrs[i].equals(Chromaticity.MONOCHROME)) {
printAttributes[CHROMATICITY_INDEX] = 1;
} else if (requestAttrs[i].equals(Chromaticity.COLOR)) {
printAttributes[CHROMATICITY_INDEX] = 2;
}
} else if (category.equals(OrientationRequested.class)) {
if (requestAttrs[i].equals(OrientationRequested.PORTRAIT)) {
printAttributes[ORIENTATION_INDEX] = 1;
} else
if (requestAttrs[i].equals(OrientationRequested.LANDSCAPE)) {
printAttributes[ORIENTATION_INDEX] = 2;
}
} else if (category.equals(PrinterResolution.class)) {
PrinterResolution res = (PrinterResolution)requestAttrs[i];
int xres = res.getCrossFeedResolution(PrinterResolution.DPI);
int yres = res.getFeedResolution(PrinterResolution.DPI);
printAttributes[XRESOLUTION_INDEX] = xres;
printAttributes[YRESOLUTION_INDEX] = yres;
} else if (category.equals(SheetCollate.class)) {
SheetCollate collate = (SheetCollate)requestAttrs[i];
if (collate == SheetCollate.COLLATED) {
printAttributes[COLLATE_INDEX] = 1;
} else if (collate == SheetCollate.UNCOLLATED) {
printAttributes[COLLATE_INDEX] = 0;
}
}
}
return printAttributes;
}