⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 e709. getting the possible values for a print job capability.txt

📁 这里面包含了一百多个JAVA源文件
💻 TXT
字号:
The capabilities of a print job are called print job attributes. Examples of print job attributes include: Copies, OrientationRequested, and Destination. This example demonstrates how to retrieve the possible values of a print job attribute. PrintService.getSupportedAttributeValues() is the method to use. This method returns 3 possible types of objects: 1) an instance of the attribute which indicates arbitrary values (e.g., Destination); 2) an array of instances of the attribute that indicates a set of specific values (e.g., OrientationRequested); and 3) an instance of something other than the attribute type that indicates that the values are limited to a particular range of values (the documentation is not clear about this particular return value). 
    Class category = OrientationRequested.class;
    Object o = service.getSupportedAttributeValues(category, null, null);
    if (o == null) {
        // Attribute is not supported
    } else if (o.getClass() == category) {
        // Attribute value is arbitrary; the actual value in o is irrelevant
    } else if (o.getClass().isArray()) {
        // Attribute values are a set of values
        for (int i=0; i<Array.getLength(o); i++) {
            Object v = Array.get(o, i);
            // v is one of the possible values
        }
    } else {
        // Attribute value is limited to a range of values represented by o
    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -