本文整理汇总了Java中javax.print.attribute.standard.PrinterResolution类的典型用法代码示例。如果您正苦于以下问题:Java PrinterResolution类的具体用法?Java PrinterResolution怎么用?Java PrinterResolution使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PrinterResolution类属于javax.print.attribute.standard包,在下文中一共展示了PrinterResolution类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSupportedAttributeCategories
import javax.print.attribute.standard.PrinterResolution; //导入依赖的package包/类
@Override
public Class<?>[] getSupportedAttributeCategories(){
ArrayList<Class> categList = new ArrayList<Class>(otherAttrCats.length+3);
for (int i=0; i < otherAttrCats.length; i++) {
categList.add(otherAttrCats[i]);
}
if (settings.get_CanDuplex()) {
categList.add(Sides.class);
}
if (settings.get_PrinterResolutions().get_Count() > 0) {
categList.add(PrinterResolution.class);
}
return categList.toArray(new Class[categList.size()]);
}
示例2: setAttribute
import javax.print.attribute.standard.PrinterResolution; //导入依赖的package包/类
public void setAttribute(final Attribute attr) {
final Class<? extends Attribute> category = attr.getCategory();
if (OrientationRequested.class.equals(category)) {
setOrientation((OrientationRequested) attr);
} else if (MediaSize.class.equals(category)) {
setPaper((MediaSize) attr);
} else if (Media.class.equals(category)) {
setPaper((MediaSizeName) attr);
} else if (Paper.class.equals(category)) {
setPaper((Paper) attr);
} else if (Copies.class.equals(category)) {
setCopies((Copies) attr);
} else if (PrintQuality.class.equals(category)) {
setPrintQuality((PrintQuality) attr);
} else if (Sides.class.equals(category)) {
setSides((Sides) attr);
} else if (SheetCollate.class.equals(category)) {
setCollate((SheetCollate) attr);
} else if (PrinterResolution.class.equals(category)) {
setPrinterResolution((PrinterResolution) attr);
} else if (Chromaticity.class.equals(category)) {
setChromaticity((Chromaticity) attr);
}
}
示例3: createResolutionCombo
import javax.print.attribute.standard.PrinterResolution; //导入依赖的package包/类
private void createResolutionCombo(PrintRequestAttributeSet set) {
PrinterResolution[] resolutions = (PrinterResolution[]) mService.getSupportedAttributeValues(PrinterResolution.class, DocFlavor.SERVICE_FORMATTED.PRINTABLE, null);
if (resolutions != null && resolutions.length > 0) {
PrinterResolution current = PrintUtilities.getResolution(mService, set, true);
WrappedPrinterResolution[] wrappers = new WrappedPrinterResolution[resolutions.length];
int selection = 0;
for (int i = 0; i < resolutions.length; i++) {
wrappers[i] = new WrappedPrinterResolution(generateResolutionTitle(resolutions[i]), resolutions[i]);
if (resolutions[i] == current) {
selection = i;
}
}
mResolution = new JComboBox<>(wrappers);
mResolution.setSelectedIndex(selection);
UIUtilities.setOnlySize(mResolution, mResolution.getPreferredSize());
LinkedLabel label = new LinkedLabel(RESOLUTION, mResolution);
add(label, new PrecisionLayoutData().setEndHorizontalAlignment());
add(mResolution);
} else {
mResolution = null;
}
}
示例4: extractFromResolutionString
import javax.print.attribute.standard.PrinterResolution; //导入依赖的package包/类
private static PrinterResolution extractFromResolutionString(String buffer) {
if (buffer != null && buffer.length() > 0) {
int sep = buffer.indexOf('x');
int x;
int y;
if (sep != -1 && sep < buffer.length() - 1) {
x = Numbers.getInteger(buffer.substring(0, sep), 0);
y = Numbers.getInteger(buffer.substring(sep + 1), 0);
} else {
x = Numbers.getInteger(buffer, 0);
y = x;
}
if (x < 1 || y < 1) {
return null;
}
return new PrinterResolution(x, y, 1);
}
return null;
}
示例5: isSupportedResolution
import javax.print.attribute.standard.PrinterResolution; //导入依赖的package包/类
private boolean isSupportedResolution(PrinterResolution res) {
PrinterResolution[] supportedRes = getPrintResolutions();
if (supportedRes != null) {
for (int i=0; i<supportedRes.length; i++) {
if (res.equals(supportedRes[i])) {
return true;
}
}
}
return false;
}
示例6: getSupportedAttributeCategories
import javax.print.attribute.standard.PrinterResolution; //导入依赖的package包/类
public Class<?>[] getSupportedAttributeCategories() {
ArrayList categList = new ArrayList(otherAttrCats.length+3);
for (int i=0; i < otherAttrCats.length; i++) {
categList.add(otherAttrCats[i]);
}
int caps = getPrinterCapabilities();
if ((caps & DEVCAP_DUPLEX) != 0) {
categList.add(Sides.class);
}
if ((caps & DEVCAP_QUALITY) != 0) {
int[] defaults = getDefaultPrinterSettings();
// Added check: if supported, we should be able to get the default.
if ((defaults[3] >= DMRES_HIGH) && (defaults[3] < 0)) {
categList.add(PrintQuality.class);
}
}
PrinterResolution[] supportedRes = getPrintResolutions();
if ((supportedRes!=null) && (supportedRes.length>0)) {
categList.add(PrinterResolution.class);
}
return (Class[])categList.toArray(new Class[categList.size()]);
}
示例7: setResolutionDPI
import javax.print.attribute.standard.PrinterResolution; //导入依赖的package包/类
private final void setResolutionDPI(int xres, int yres) {
if (attributes != null) {
PrinterResolution res =
new PrinterResolution(xres, yres, PrinterResolution.DPI);
attributes.add(res);
}
mAttXRes = xres;
mAttYRes = yres;
}
示例8: getSupportedAttributeCategories
import javax.print.attribute.standard.PrinterResolution; //导入依赖的package包/类
public Class<?>[] getSupportedAttributeCategories() {
ArrayList<Class<?>> categList = new ArrayList<>(otherAttrCats.length+3);
for (int i=0; i < otherAttrCats.length; i++) {
categList.add(otherAttrCats[i]);
}
int caps = getPrinterCapabilities();
if ((caps & DEVCAP_DUPLEX) != 0) {
categList.add(Sides.class);
}
if ((caps & DEVCAP_QUALITY) != 0) {
int[] defaults = getDefaultPrinterSettings();
// Added check: if supported, we should be able to get the default.
if ((defaults[3] >= DMRES_HIGH) && (defaults[3] < 0)) {
categList.add(PrintQuality.class);
}
}
PrinterResolution[] supportedRes = getPrintResolutions();
if ((supportedRes!=null) && (supportedRes.length>0)) {
categList.add(PrinterResolution.class);
}
return categList.toArray(new Class<?>[categList.size()]);
}
示例9: setResolutionDPI
import javax.print.attribute.standard.PrinterResolution; //导入依赖的package包/类
private void setResolutionDPI(int xres, int yres) {
if (attributes != null) {
PrinterResolution res =
new PrinterResolution(xres, yres, PrinterResolution.DPI);
attributes.add(res);
}
mAttXRes = xres;
mAttYRes = yres;
}
示例10: getAssociatedAttributeArray
import javax.print.attribute.standard.PrinterResolution; //导入依赖的package包/类
/**
* Constructs an array from a set of -supported attributes.
* @param set set to process
* @return The constructed array.
*
* @see #getAssociatedAttribute()
*/
public static PrinterResolution[]
getAssociatedAttributeArray(Set<Attribute> set)
{
PrinterResolution[] result = new PrinterResolution[set.size()];
int j = 0;
for (Attribute tmp : set)
{
result[j] = ((PrinterResolutionSupported) tmp).getAssociatedAttribute();
j++;
}
return result;
}
示例11: getAssociatedAttributeArray
import javax.print.attribute.standard.PrinterResolution; //导入依赖的package包/类
/**
* Constructs an array from a set of -supported attributes.
* @param set set to process
* @return The constructed array.
*
* @see #getAssociatedAttribute()
*/
public static PrinterResolution[] getAssociatedAttributeArray(Set set)
{
PrinterResolutionSupported tmp;
PrinterResolution[] result = new PrinterResolution[set.size()];
Iterator it = set.iterator();
int j = 0;
while (it.hasNext())
{
tmp = (PrinterResolutionSupported) it.next();
result[j] = tmp.getAssociatedAttribute();
j++;
}
return result;
}