本文整理汇总了Java中javax.print.attribute.standard.Sides.equals方法的典型用法代码示例。如果您正苦于以下问题:Java Sides.equals方法的具体用法?Java Sides.equals怎么用?Java Sides.equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.print.attribute.standard.Sides
的用法示例。
在下文中一共展示了Sides.equals方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: selectSidesButton
import javax.print.attribute.standard.Sides; //导入方法依赖的package包/类
private void selectSidesButton(Sides par) {
if (par == null) {
par = Sides.ONE_SIDED;
}
if (par.equals(Sides.TUMBLE)
|| par.equals(Sides.TWO_SIDED_SHORT_EDGE)) {
tumbleBtn.setSelected(true);
} else if (par.equals(Sides.DUPLEX)
|| par.equals(Sides.TWO_SIDED_LONG_EDGE)) {
duplexBtn.setSelected(true);
} else {
oneSideBtn.setSelected(true);
}
}
示例2: sideIsEnabled
import javax.print.attribute.standard.Sides; //导入方法依赖的package包/类
private boolean sideIsEnabled(Sides par) {
if (par == null) {
return false;
} else if (par.equals(Sides.ONE_SIDED)) {
return oneSideBtn.isEnabled();
} else if (par.equals(Sides.DUPLEX) ||
par.equals(Sides.TWO_SIDED_LONG_EDGE)) {
return duplexBtn.isEnabled();
} else if (par.equals(Sides.TUMBLE) ||
par.equals(Sides.TWO_SIDED_SHORT_EDGE)) {
return tumbleBtn.isEnabled();
} else {
return false;
}
}
示例3: convertAttributes
import javax.print.attribute.standard.Sides; //导入方法依赖的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;
}