本文整理汇总了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];
}
}
示例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);
}
}
示例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 ();
}
}
}