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


Java Copies类代码示例

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


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

示例1: setRangeCopiesAttribute

import javax.print.attribute.standard.Copies; //导入依赖的package包/类
private final void setRangeCopiesAttribute(int from, int to,
                                           boolean isRangeSet,
                                           int copies) {
    if (attributes != null) {
        if (isRangeSet) {
            attributes.add(new PageRanges(from, to));
            setPageRange(from, to);
        }
        defaultCopies = false;
        attributes.add(new Copies(copies));
        /* Since this is called from native to tell Java to sync
         * up with native, we don't call this class's own setCopies()
         * method which is mainly to send the value down to native
         */
        super.setCopies(copies);
        mAttCopies = copies;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:WPrinterJob.java

示例2: printWithoutPrintDialog

import javax.print.attribute.standard.Copies; //导入依赖的package包/类
private static void printWithoutPrintDialog() {

        final JTable table = createAuthorTable(42);
        PrintRequestAttributeSet pras
                = new HashPrintRequestAttributeSet();
        pras.add(new Copies(1));

        try {

            boolean printAccepted = table.print(JTable.PrintMode.FIT_WIDTH,
                    new MessageFormat("Author Table"),
                    new MessageFormat("Page - {0}"),
                    false, pras, false);

            closeFrame();
            if (!printAccepted) {
                throw new RuntimeException("User cancels the printer job!");
            }

        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:24,代码来源:ImageableAreaTest.java

示例3: setRangeCopiesAttribute

import javax.print.attribute.standard.Copies; //导入依赖的package包/类
private void setRangeCopiesAttribute(int from, int to, boolean isRangeSet,
                                     int copies) {
    if (attributes != null) {
        if (isRangeSet) {
            attributes.add(new PageRanges(from, to));
            setPageRange(from, to);
        }
        defaultCopies = false;
        attributes.add(new Copies(copies));
        /* Since this is called from native to tell Java to sync
         * up with native, we don't call this class's own setCopies()
         * method which is mainly to send the value down to native
         */
        super.setCopies(copies);
        mAttCopies = copies;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:WPrinterJob.java

示例4: printWithoutPrintDialog

import javax.print.attribute.standard.Copies; //导入依赖的package包/类
private static void printWithoutPrintDialog() {

        final JTable table = createAuthorTable(50);
        PrintRequestAttributeSet pras
                = new HashPrintRequestAttributeSet();
        pras.add(new Copies(1));

        try {

            boolean printAccepted = table.print(JTable.PrintMode.FIT_WIDTH,
                    new MessageFormat("Author Table"),
                    new MessageFormat("Page - {0}"),
                    false, pras, false);

            closeFrame();
            if (!printAccepted) {
                throw new RuntimeException("User cancels the printer job!");
            }

        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:24,代码来源:ImageableAreaTest.java

示例5: actionPerformed

import javax.print.attribute.standard.Copies; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent e)
{
    try {
        if (selectedDriver == null)
            return;

        PrintService ps = (PrintService)printers.getSelectedItem();
        PrintRequestAttributeSet attr = new HashPrintRequestAttributeSet();

        attr.add(new Copies(1));
        attr.add((Media)ps.getDefaultAttributeValue(Media.class)); // set to default paper from printer
        attr.add(OrientationRequested.LANDSCAPE);

        SimpleDoc doc = new SimpleDoc(activeLabel, DocFlavor.SERVICE_FORMATTED.PRINTABLE, null);
        ps.createPrintJob().print(doc, attr);
    }  catch (PrintException ex) {
        log.log(Level.SEVERE, "\bBarcode print failed: " + ex.getMessage(), ex);
    }
}
 
开发者ID:drytoastman,项目名称:scorekeeperfrontend,代码行数:21,代码来源:EntryPanel.java

示例6: imprimir

import javax.print.attribute.standard.Copies; //导入依赖的package包/类
public boolean imprimir(boolean bMonta) {
	if (bMonta)
		montaG();

	boolean bRet = false;
	PrinterJob printJob = PrinterJob.getPrinterJob();
	PrintRequestAttributeSet aset = Funcoes.getImpAtrib();
	if (printJob.printDialog(aset)) {
		try {
			printJob.setPrintable(this, new PaginaPad(printJob.defaultPage().getPaper()));
			printJob.print(aset);
			aset.remove(Copies.class);

			Funcoes.setImpAtrib(aset);
			bRet = true;
		}
		catch (Exception ex) {
			ex.printStackTrace();
		}
	}

	return bRet;
}
 
开发者ID:cams7,项目名称:erp,代码行数:24,代码来源:ImprimeLayout.java

示例7: assignPrintAttributes

import javax.print.attribute.standard.Copies; //导入依赖的package包/类
private PrintRequestAttributeSet assignPrintAttributes() throws PrintException {
    PrintRequestAttributeSet printRequestAttributeSet = new HashPrintRequestAttributeSet();
    if (config.getCopies() >= 1) {
        printRequestAttributeSet.add(new Copies(config.getCopies()));
    } else {
        throw new PrintException("Number of print copies should be greater than zero");
    }
    printRequestAttributeSet.add(config.getMediaSizeName());
    printRequestAttributeSet.add(config.getInternalSides());
    printRequestAttributeSet.add(config.getInternalOrientation());

    if (config.getMediaTray() != null) {
        MediaTray mediaTray = resolveMediaTray(config.getMediaTray());
    
        if (mediaTray == null) {
            throw new PrintException("mediatray not found " + config.getMediaTray());
        }
        
        printRequestAttributeSet.add(mediaTray);
    }
    
    return printRequestAttributeSet;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:24,代码来源:PrinterProducer.java

示例8: print

import javax.print.attribute.standard.Copies; //导入依赖的package包/类
/**
 * 	Print (async)
 * 	@param printerName optional printer name
 *  @param jobName optional printer job name
 * 	@param pageable pageable
 *  @param copies number of copies
 *  @param withDialog if true, shows printer dialog
 */
static public void print (Pageable pageable, String printerName, String jobName,
	int copies, boolean withDialog)
{
	if (pageable == null)
		return;
	String name = "Adempiere_";
	if (jobName != null)
		name += jobName;
	//
	PrinterJob job = CPrinter.getPrinterJob(printerName);
	job.setJobName (name);
	job.setPageable (pageable);
	//	Attributes
	HashPrintRequestAttributeSet prats = new HashPrintRequestAttributeSet();
	prats.add(new Copies(copies));
	//	Set Orientation
	if (pageable.getPageFormat(0).getOrientation() == PageFormat.PORTRAIT)
		prats.add(OrientationRequested.PORTRAIT);
	else
		prats.add(OrientationRequested.LANDSCAPE);
	prats.add(new JobName(name, Language.getLoginLanguage().getLocale()));
	prats.add(getJobPriority(pageable.getNumberOfPages(), copies, withDialog));
	//
	print (job, prats, withDialog, false);
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:34,代码来源:PrintUtil.java

示例9: setRangeCopiesAttribute

import javax.print.attribute.standard.Copies; //导入依赖的package包/类
private final void setRangeCopiesAttribute(int from, int to,
                                           boolean isRangeSet,
                                           int copies) {
    if (attributes != null) {
        if (isRangeSet) {
            attributes.add(new PageRanges(from, to));
            setPageRange(from, to);
        }
        attributes.add(new Copies(copies));
        /* Since this is called from native to tell Java to sync
         * up with native, we don't call this class's own setCopies()
         * method which is mainly to send the value down to native
         */
        super.setCopies(copies);
        mAttCopies = copies;
    }
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:18,代码来源:WPrinterJob.java

示例10: setAttribute

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

示例11: getDefaultAttributeValue

import javax.print.attribute.standard.Copies; //导入依赖的package包/类
public Object getDefaultAttributeValue(Class category) {
    if (category.equals(JobName.class)) {
        return new JobName("Java GDI client print job", Locale.US);
    } else if (category.equals(RequestingUserName.class)) {
        return new RequestingUserName(System.getProperty("user.name"),
                Locale.US);
    } else if (category.equals(Destination.class)) {
        File file = new File(System.getProperty("user.dir") +
                File.separator + "output.prn");
        return new Destination(file.toURI());
    } else if (category.equals(SheetCollate.class)) {
        return SheetCollate.COLLATED;
    } else if (category.equals(Copies.class)) {
        return new Copies(1);
    }
    return null;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:18,代码来源:GDIClient.java

示例12: print

import javax.print.attribute.standard.Copies; //导入依赖的package包/类
public static void print(File file, int copies, PrintService ps) {
    logger.debug("print start - " + file);
    try {
        try (PDDocument document = PDDocument.load(file)) {
            MediaSizeName size = getMediaSizeName(document);
            
            PrinterJob job = PrinterJob.getPrinterJob();
            job.setPrintService(ps);
            job.setPageable(new PDFPageable(document));
            PrintRequestAttributeSet attr = new HashPrintRequestAttributeSet();
            attr.add(size);
            attr.add(new Copies(copies));
            attr.add(new JobName(file.getName(), null));
            
            PageFormat pf = job.getPageFormat(attr);
            Paper paper = pf.getPaper();
            paper.setImageableArea(0, 0, paper.getWidth(), paper.getHeight());
            pf.setPaper(paper);
            
            job.print(attr);
        }
    } catch (IOException | PrinterException ex) {
        logger.warn(ex, ex);
    }
    logger.debug("print end - " + file);
}
 
开发者ID:montsuqi,项目名称:monsiaj,代码行数:27,代码来源:PDFPrint.java

示例13: isSupportedCopies

import javax.print.attribute.standard.Copies; //导入依赖的package包/类
private boolean isSupportedCopies(Copies copies) {
    synchronized (this) {
        if (gotCopies == false) {
            nCopies = getCopiesSupported(printer, getPort());
            gotCopies = true;
        }
    }
    int numCopies = copies.getValue();
    return (numCopies > 0 && numCopies <= nCopies);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:Win32PrintService.java

示例14: isPSDocAttr

import javax.print.attribute.standard.Copies; //导入依赖的package包/类
private boolean isPSDocAttr(Class category) {
    if (category == OrientationRequested.class || category == Copies.class) {
            return true;
    }
    else {
        return false;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:Win32PrintService.java

示例15: pageableJob

import javax.print.attribute.standard.Copies; //导入依赖的package包/类
public void pageableJob(Pageable pageable) throws PrintException {
    try {
        synchronized(this) {
            if (job != null) { // shouldn't happen
                throw new PrintException("already printing");
            } else {
                job = new sun.awt.windows.WPrinterJob();
            }
        }
        PrintService svc = getPrintService();
        job.setPrintService(svc);
        if (copies == 0) {
            Copies c = (Copies)svc.getDefaultAttributeValue(Copies.class);
            copies = c.getValue();
        }
        job.setCopies(copies);
        job.setJobName(jobName);
        job.setPageable(pageable);
        job.print(reqAttrSet);
        notifyEvent(PrintJobEvent.DATA_TRANSFER_COMPLETE);
        return;
    } catch (PrinterException pe) {
        notifyEvent(PrintJobEvent.JOB_FAILED);
        throw new PrintException(pe);
    } finally {
        printReturned = true;
        notifyEvent(PrintJobEvent.NO_MORE_EVENTS);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:Win32PrintJob.java


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