当前位置: 首页>>代码示例>>Java>>正文


Java PrinterResolution类代码示例

本文整理汇总了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()]);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:Win32PrintService.java

示例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);
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:26,代码来源:DevmodeStructWrapper.java

示例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;
	}
}
 
开发者ID:Ayutac,项目名称:toolkit,代码行数:23,代码来源:PageSetupPanel.java

示例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;
}
 
开发者ID:Ayutac,项目名称:toolkit,代码行数:21,代码来源:PrintManager.java

示例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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:Win32PrintService.java

示例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()]);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:28,代码来源:Win32PrintService.java

示例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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:WPrinterJob.java

示例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()]);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:28,代码来源:Win32PrintService.java

示例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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:WPrinterJob.java

示例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;
}
 
开发者ID:vilie,项目名称:javify,代码行数:20,代码来源:PrinterResolutionSupported.java

示例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;
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:22,代码来源:PrinterResolutionSupported.java


注:本文中的javax.print.attribute.standard.PrinterResolution类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。