import org.eclipse.swt.printing.PrintDialog; import org.eclipse.swt.printing.PrinterData; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; public class MainClass { public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); PrintDialog dlg = new PrintDialog(shell); PrinterData printerData = dlg.open(); if (printerData != null) { System.out.println(printerData.printToFile); // Printer printer = new Printer(printerData); // Use printer . . . // printer.dispose(); } while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); } }