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


Java SelectPrinter.setVisible方法代码示例

本文整理汇总了Java中com.openbravo.pos.util.SelectPrinter.setVisible方法的典型用法代码示例。如果您正苦于以下问题:Java SelectPrinter.setVisible方法的具体用法?Java SelectPrinter.setVisible怎么用?Java SelectPrinter.setVisible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.openbravo.pos.util.SelectPrinter的用法示例。


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

示例1: endReceipt

import com.openbravo.pos.util.SelectPrinter; //导入方法依赖的package包/类
/**
 * Method that is responsible for ending and printing a ticket<br>
 * It manages to get a printerJob, set the name of the job, get a Book object<br>
 * and print the receipt
 */
@Override
public void endReceipt() {

    try {

        PrintService ps;

        if (printservice == null) {
            String[] printers = ReportUtils.getPrintNames();
            if (printers.length == 0) {
                logger.warning(AppLocal.getIntString("message.noprinters"));
                ps = null;
            } else {
                SelectPrinter selectprinter = SelectPrinter.getSelectPrinter(parent, printers);
                selectprinter.setVisible(true);
                if (selectprinter.isOK()) {
                    ps = ReportUtils.getPrintService(selectprinter.getPrintService());
                } else {
                    ps = null;
                }
            }
        } else {
            ps = printservice;
        }

        if (ps != null)  {

            PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
            aset.add(OrientationRequested.PORTRAIT);
            aset.add(new JobName(AppLocal.APP_NAME + " - Document", null));
            aset.add(media);

            DocPrintJob printjob = ps.createPrintJob();
            Doc doc = new SimpleDoc(new PrintableBasicTicket(m_ticketcurrent, imageable_x, imageable_y, imageable_width, imageable_height), DocFlavor.SERVICE_FORMATTED.PRINTABLE, null);

            printjob.print(doc, aset);
        }

    } catch (PrintException ex) {
        logger.log(Level.WARNING, AppLocal.getIntString("message.printererror"), ex);
        JMessageDialog.showMessage(parent, new MessageInf(MessageInf.SGN_WARNING, AppLocal.getIntString("message.printererror"), ex));
    }

    //ticket is not needed any more
    m_ticketcurrent = null;
}
 
开发者ID:iMartinezMateu,项目名称:openbravo-pos,代码行数:52,代码来源:DevicePrinterPrinter.java


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