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


Java Printer.getDefaultPrinterData方法代码示例

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


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

示例1: JaretTablePrintDialog

import org.eclipse.swt.printing.Printer; //导入方法依赖的package包/类
public JaretTablePrintDialog(Shell parentShell, String printerName, JaretTablePrinter tablePrinter,
        JaretTablePrintConfiguration printConfiguration) {
    super(parentShell);
    _tablePrinter = tablePrinter;
    _configuration = printConfiguration;
    if (_configuration == null) {
        _configuration = new JaretTablePrintConfiguration("table", false, 1.0);
    }
    if (printerName == null && _printerData != null) {
        printerName = _printerData.name;
    }

    _pdatas = Printer.getPrinterList();
    _printers = new String[_pdatas.length];
    int stdIdx = -1;
    for (int i = 0; i < _pdatas.length; i++) {
        PrinterData pd = _pdatas[i];
        _printers[i] = pd.name;
        if (printerName != null && pd.name.equals(printerName)) {
            _pIdx = i;
        }
        if (pd.name.equals(Printer.getDefaultPrinterData().name)) {
            stdIdx = i;
        }
    }
    if (_pIdx == -1) {
        _printerData = Printer.getDefaultPrinterData();
        _pIdx = stdIdx;
    } else {
        _printerData = _pdatas[_pIdx];
    }
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:33,代码来源:JaretTablePrintDialog.java

示例2: PrintSpool

import org.eclipse.swt.printing.Printer; //导入方法依赖的package包/类
public PrintSpool()
{
	printerdata = Printer.getDefaultPrinterData();
	if ( printerdata != null )
	{
		// Fail silently instead of crashing.
	    printer = new Printer(printerdata);
	}
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:10,代码来源:PrintSpool.java

示例3: print

import org.eclipse.swt.printing.Printer; //导入方法依赖的package包/类
public void print ()
{
    if ( Printer.getPrinterList ().length == 0 )
    {
        MessageDialog.openInformation ( this.shell, "No printer", "No installed printer could be found" );
        return;
    }

    final PrintDialog dlg = new PrintDialog ( this.shell, SWT.APPLICATION_MODAL );

    final PrinterData initialPd = Printer.getDefaultPrinterData ();
    initialPd.orientation = PrinterData.LANDSCAPE;
    dlg.setPrinterData ( initialPd );

    final PrinterData pd = dlg.open ();

    if ( pd != null )
    {
        final Printer printer = new Printer ( pd );
        final ResourceManager rm = new DeviceResourceManager ( printer );
        try
        {
            printer.startJob ( "Chart" );
            printer.startPage ();

            final GC gc = new GC ( printer );
            try
            {
                final SWTGraphics g = new SWTGraphics ( gc, rm );
                try
                {
                    this.viewer.getChartRenderer ().paint ( g );
                }
                finally
                {
                    g.dispose ();
                }
            }
            finally
            {
                gc.dispose ();
            }

            printer.endPage ();
            printer.endJob ();
        }
        finally
        {
            rm.dispose ();
            printer.dispose ();
        }
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:54,代码来源:AbstractChartView.java


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