• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Chromaticity类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中javax.print.attribute.standard.Chromaticity的典型用法代码示例。如果您正苦于以下问题:Java Chromaticity类的具体用法?Java Chromaticity怎么用?Java Chromaticity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Chromaticity类属于javax.print.attribute.standard包,在下文中一共展示了Chromaticity类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: doTest

import javax.print.attribute.standard.Chromaticity; //导入依赖的package包/类
private static void doTest() {
    PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
    aset.add(Chromaticity.MONOCHROME);

    MediaSize isoA5Size = MediaSize.getMediaSizeForName(MediaSizeName.ISO_A5);
    float[] size = isoA5Size.getSize(Size2DSyntax.INCH);
    Paper paper = new Paper();
    paper.setSize(size[0] * 72.0, size[1] * 72.0);
    paper.setImageableArea(0.0, 0.0, size[0] * 72.0, size[1] * 72.0);
    PageFormat pf = new PageFormat();
    pf.setPaper(paper);

    PrinterJob job = PrinterJob.getPrinterJob();
    job.setPrintable(new WrongPaperPrintingTest(), job.validatePage(pf));
    if (job.printDialog()) {
        try {
            job.print(aset);
        } catch (PrinterException pe) {
            throw new RuntimeException(pe);
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:WrongPaperPrintingTest.java


示例2: setAttribute

import javax.print.attribute.standard.Chromaticity; //导入依赖的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: fillColorFields

import javax.print.attribute.standard.Chromaticity; //导入依赖的package包/类
void fillColorFields() {
    boolean lastIsMonochrome = getLastColor();   
   
    monoBtn.setEnabled(false);
    colorBtn.setEnabled(false);

    if (myService.isAttributeCategorySupported(Chromaticity.class)) {
        Chromaticity [] supported = (Chromaticity []) (myService
              .getSupportedAttributeValues(Chromaticity.class, flavor, attrs));
        if (supported != null) {
            if (supported.length == 1) {
                lastIsMonochrome = setMonochrome(
                        (supported[0]).equals(Chromaticity.MONOCHROME));
            } else if (supported.length > 1) {
                monoBtn.setEnabled(true);
                colorBtn.setEnabled(true);
            }
        }
    }

    if (lastIsMonochrome) {
        monoBtn.setSelected(true);
    } else {
        colorBtn.setSelected(true);
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:27,代码来源:ServiceUIDialog.java


示例4: getLastColor

import javax.print.attribute.standard.Chromaticity; //导入依赖的package包/类
private boolean getLastColor() {
    if (firstUse) {
        if (attrs.containsKey(Chromaticity.class)) {
            Attribute value = attrs.get(Chromaticity.class);
            return value.equals(Chromaticity.MONOCHROME);
        } 
        
        Object defaul = myService.getDefaultAttributeValue(Chromaticity.class);
        return (myService.isAttributeCategorySupported(Chromaticity.class)
                    && (defaul != null))
                ? defaul.equals(Chromaticity.MONOCHROME)
                : true;
    } 

    return monoBtn.isSelected();
}
 
开发者ID:shannah,项目名称:cn1,代码行数:17,代码来源:ServiceUIDialog.java


示例5: createChromaticityCombo

import javax.print.attribute.standard.Chromaticity; //导入依赖的package包/类
private void createChromaticityCombo(PrintRequestAttributeSet set) {
	Chromaticity[] chromacities = (Chromaticity[]) mService.getSupportedAttributeValues(Chromaticity.class, DocFlavor.SERVICE_FORMATTED.PRINTABLE, null);
	if (chromacities != null && chromacities.length > 0) {
		HashSet<Chromaticity> possible = new HashSet<>();
		for (Chromaticity one : chromacities) {
			possible.add(one);
		}
		ArrayList<InkChromaticity> choices = new ArrayList<>();
		for (InkChromaticity chromaticity : InkChromaticity.values()) {
			if (possible.contains(chromaticity.getChromaticity())) {
				choices.add(chromaticity);
			}
		}
		mChromaticity = new JComboBox<>(choices.toArray(new InkChromaticity[0]));
		mChromaticity.setSelectedItem(PrintUtilities.getChromaticity(mService, set, true));
		UIUtilities.setOnlySize(mChromaticity, mChromaticity.getPreferredSize());
		LinkedLabel label = new LinkedLabel(CHROMATICITY, mChromaticity);
		add(label, new PrecisionLayoutData().setEndHorizontalAlignment());
		add(mChromaticity);
	} else {
		mChromaticity = null;
	}
}
 
开发者ID:Ayutac,项目名称:toolkit,代码行数:24,代码来源:PageSetupPanel.java


示例6: printComponent

import javax.print.attribute.standard.Chromaticity; //导入依赖的package包/类
public static void printComponent(Component c) {
  // Get a list of all printers that can handle Printable objects.
  DocFlavor flavor = DocFlavor.SERVICE_FORMATTED.PRINTABLE;
  PrintService[] services = PrintServiceLookup.lookupPrintServices(flavor, null);
  // Set some define printing attributes
  PrintRequestAttributeSet printAttributes = new HashPrintRequestAttributeSet();
  //printAttributes.add(OrientationRequested.LANDSCAPE); // landscape mode
  printAttributes.add(OrientationRequested.PORTRAIT);                    // PORTRAIT mode
  printAttributes.add(Chromaticity.MONOCHROME);                          // print in mono
  printAttributes.add(javax.print.attribute.standard.PrintQuality.HIGH); // highest resolution
  // Display a dialog that allows the user to select one of the
  // available printers and to edit the default attributes
  PrintService service = ServiceUI.printDialog(null, 100, 100, services, null, null, printAttributes);
  // If the user canceled, don't do anything
  if(service==null) {
    return;
  }
  // Now call a method defined below to finish the printing
  printToService(c, service, printAttributes);
}
 
开发者ID:OpenSourcePhysics,项目名称:osp,代码行数:21,代码来源:PrintUtils.java


示例7: setColorAttrib

import javax.print.attribute.standard.Chromaticity; //导入依赖的package包/类
private void setColorAttrib(Attribute attr) {
    if (attr == Chromaticity.COLOR) {
        mAttChromaticity = 2; // DMCOLOR_COLOR
    } else {
        mAttChromaticity = 1; // DMCOLOR_MONOCHROME
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:WPrinterJob.java


示例8: actionPerformed

import javax.print.attribute.standard.Chromaticity; //导入依赖的package包/类
@Override final public void actionPerformed(ActionEvent objPactionEvent) {
	final Object objLsourceObject = objPactionEvent.getSource();

	if (this.objGmonochromePrintIconJRadioButton.isSameAs(objLsourceObject)) {
		this.objGprintJDialog.getAttributes().add(Chromaticity.MONOCHROME);
	} else if (this.objGcolorPrintIconJRadioButton.isSameAs(objLsourceObject)) {
		this.objGprintJDialog.getAttributes().add(Chromaticity.COLOR);
	}
}
 
开发者ID:jugglemaster,项目名称:JuggleMasterPro,代码行数:10,代码来源:PrintChromaticitySubJPanel.java


示例9: actionPerformed

import javax.print.attribute.standard.Chromaticity; //导入依赖的package包/类
public void actionPerformed(ActionEvent e)
{
  if (e.getSource() == bw)
    atts.add(Chromaticity.MONOCHROME);
  else
    atts.add(Chromaticity.COLOR);
}
 
开发者ID:vilie,项目名称:javify,代码行数:8,代码来源:PrinterDialog.java


示例10: updateForSelectedService

import javax.print.attribute.standard.Chromaticity; //导入依赖的package包/类
/**
 * Called to update for new selected
 * print service. Tests if currently
 * selected attributes are supported.
 */
void updateForSelectedService()
{
  if (categorySupported(Chromaticity.class))
    {
      bw.setEnabled(true);
      color.setEnabled(true);

      Object defaultValue = defaultValue(Chromaticity.class);
      Attribute chromaticity = attribute(Chromaticity.class);
      if (chromaticity != null)
        {
          if (chromaticity.equals(Chromaticity.MONOCHROME))
            bw.setSelected(true);
          else
            color.setSelected(true);
        }
      else
        {
          if (defaultValue.equals(Chromaticity.MONOCHROME))
            bw.setSelected(true);
          else
            color.setSelected(true);
        }
    }
  else
    {
      bw.setEnabled(false);
      color.setEnabled(false);
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:36,代码来源:PrinterDialog.java


示例11: actionPerformed

import javax.print.attribute.standard.Chromaticity; //导入依赖的package包/类
public void actionPerformed(ActionEvent e)
{
  if (e.getSource() == bw)
    atts.add(Chromaticity.MONOCHROME);        
  else
    atts.add(Chromaticity.COLOR);
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:8,代码来源:PrinterDialog.java


示例12: updateForSelectedService

import javax.print.attribute.standard.Chromaticity; //导入依赖的package包/类
/**
 * Called to update for new selected
 * print service. Tests if currently
 * selected attributes are supported.
 */
void updateForSelectedService()
{
  if (categorySupported(Chromaticity.class))
    {
      bw.setEnabled(true);
      color.setEnabled(true);           
      
      Object defaultValue = defaultValue(Chromaticity.class);           
      Attribute chromaticity = attribute(Chromaticity.class);
      if (chromaticity != null)
        {
          if (chromaticity.equals(Chromaticity.MONOCHROME))
            bw.setSelected(true);
          else 
            color.setSelected(true);
        }
      else
        {
          if (defaultValue.equals(Chromaticity.MONOCHROME))
            bw.setSelected(true);
          else               
            color.setSelected(true);
        }
    }
  else
    {           
      bw.setEnabled(false);
      color.setEnabled(false);
    }
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:36,代码来源:PrinterDialog.java


示例13: getDefaultAttributeValue

import javax.print.attribute.standard.Chromaticity; //导入依赖的package包/类
public Object getDefaultAttributeValue(
                final Class<? extends Attribute> category) {
    checkArgs(category, null);

    final DevmodeStructWrapper dm = getDefaultPrinterProps();

    if (JobName.class.equals(category)) {
        return DEFAULT_JOB_NAME;
    } else if (RequestingUserName.class.equals(category)) {
        return new RequestingUserName(getSystemProperty("user.name"), //$NON-NLS-1$
                        null);
    } else if (Destination.class.equals(category)) {
        File file = new File(getSystemProperty("user.dir") //$NON-NLS-1$
                        + File.separator + "output.prn"); //$NON-NLS-1$
        return new Destination(file.toURI());
    } else if (OrientationRequested.class.equals(category)) {
        return dm.getOrientation();
    } else if (Paper.class.equals(category)) {
        return getDefaultPaper();
    } else if (Media.class.equals(category)) {
        return getDefaultPaper().getSize().getMediaSizeName();
    } else if (MediaSize.class.equals(category)) {
        return getDefaultPaper().getSize();
    } else if (PrintQuality.class.equals(category)) {
        return dm.getPrintQuality();
    } else if (Sides.class.equals(category)) {
        return dm.getSides();
    } else if (Copies.class.equals(category)) {
        return dm.getCopies();
    } else if (SheetCollate.class.equals(category)) {
        return dm.getCollate();
    } else if (PrinterResolution.class.equals(category)) {
        return dm.getPrinterResolution();
    } else if (Chromaticity.class.equals(category)) {
        return dm.getChromaticity();
    }

    return null;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:40,代码来源:WinPrintService.java


示例14: setChromaticity

import javax.print.attribute.standard.Chromaticity; //导入依赖的package包/类
public void setChromaticity(final Chromaticity chromaticity) {
    if (Chromaticity.COLOR.equals(chromaticity)) {
        setDmColor(structPtr, DMCOLOR_COLOR);
    } else if (Chromaticity.MONOCHROME.equals(chromaticity)) {
        setDmColor(structPtr, DMCOLOR_MONOCHROME);
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:8,代码来源:DevmodeStructWrapper.java


示例15: getSupportedAttributeCategories

import javax.print.attribute.standard.Chromaticity; //导入依赖的package包/类
public Class[] getSupportedAttributeCategories() {
    ArrayList supportedCategories = new ArrayList();
    if (getCopiesSupported(serviceName) >= 1) {
        supportedCategories.add(Copies.class);
    }
    if (getSidesSupported(serviceName)) {
        supportedCategories.add(Sides.class);
    }
    if (getSupportedMediaSizeNames() != null) {
        supportedCategories.add(Media.class);
    }
    if (getResolutionsSupported(serviceName) != null) {
        supportedCategories.add(PrinterResolution.class);
    }
    if (getOrientationSupported(serviceName)) {
        supportedCategories.add(OrientationRequested.class);
    }
    if (getCollateSupported(serviceName)) {
        supportedCategories.add(SheetCollate.class);
    }
    supportedCategories.add(Chromaticity.class);
    supportedCategories.add(JobName.class);
    supportedCategories.add(RequestingUserName.class);
    supportedCategories.add(Destination.class);
    
    Class[] categories = new Class[supportedCategories.size()];
    supportedCategories.toArray(categories);
    return categories;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:30,代码来源:GDIClient.java


示例16: updateColor

import javax.print.attribute.standard.Chromaticity; //导入依赖的package包/类
private void updateColor() {
    if (monoBtn.isEnabled() && monoBtn.isSelected()) {
        newAttrs.add(Chromaticity.MONOCHROME);
    } else if (colorBtn.isEnabled() && colorBtn.isSelected()) {
        newAttrs.add(Chromaticity.COLOR);
    } else {
        removeAttribute(Chromaticity.class);
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:10,代码来源:ServiceUIDialog.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AnnotationIntrospector类代码示例发布时间:2022-05-21
下一篇:
Java JMSConsumer类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap