Package org.eclipse.swt.printing

Examples of org.eclipse.swt.printing.PrintDialog.open()


public class PrintCommand extends AbstractHandler {

  @Override
  public Object execute(ExecutionEvent event) throws ExecutionException {
    PrintDialog printDialog = new PrintDialog(HandlerUtil.getActiveShell(event));
    PrinterData printerData = printDialog.open();
   
    if(printerData != null ) {
      Printer printer = new Printer(printerData);
      if(printer.startJob("Text")) {
        GC gc = new GC(printer);
View Full Code Here


   *
   * @since 3.4
   */
  public void print(StyledTextPrintOptions options) {
    final PrintDialog dialog= new PrintDialog(fTextWidget.getShell(), SWT.PRIMARY_MODAL);
    final PrinterData data= dialog.open();

    if (data != null) {
      final Printer printer= new Printer(data);
      final Runnable styledTextPrinter= fTextWidget.print(printer, options);

View Full Code Here

     *
     * @param elementToPrint  the {@link Composite} to be printed.
     */
    public void print(Composite elementToPrint) {
        PrintDialog dialog = new PrintDialog(elementToPrint.getShell());
        PrinterData printerData = dialog.open();
        if (printerData == null) {
            return; // Anwender hat abgebrochen.
        }
        startPrintJob(elementToPrint, printerData);
    }
View Full Code Here

      Button printersetup = new Button (buttonPanel, SWT.PUSH);
      printersetup.setText ("Select Printer");
      printersetup.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event event) {
          PrintDialog dialog = new PrintDialog(getShell(), SWT.NONE);
          PrinterData printerData = dialog.open ();
          if (printerData != null) {
            preview.setPrinterData(printerData);
            preview.setPageFrame(pageFrame);
          }
        }
View Full Code Here

      return;
    }

    final PrintDialog dialog= new PrintDialog(shell, SWT.PRIMARY_MODAL);
    dialog.setPrinterData(fgPrinterData);
    final PrinterData data= dialog.open();

    if (data != null) {
      final Printer printer= new Printer(data);
      final Runnable styledTextPrinter= fTextWidget.print(printer, options);
View Full Code Here

        final PrintDialog printDialog = new PrintDialog(shell);
        printDialog.setStartPage(1);
        printDialog.setEndPage(pageCount.x * pageCount.y);
        printDialog.setScope(PrinterData.ALL_PAGES);

        PrinterData printerData = printDialog.open();
        if (printerData == null) {
            return null;
        }
        return new Printer(printerData);
    }
View Full Code Here

      return;

    try {
      // Ask the user to specify the printer.
      PrintDialog dialog = new PrintDialog(shell, SWT.NONE);
      PrinterData printerData = dialog.open();
      if (printerData == null)
        return;

      Printer printer = new Printer(printerData);
      Point screenDPI = display.getDPI();
View Full Code Here

    }

    if (name.equals(ControlExample.getResourceString("PrintDialog"))) {
      PrintDialog dialog = new PrintDialog(shell, style);
      dialog.setText(ControlExample.getResourceString("Title"));
      PrinterData result = dialog.open();
      textWidget.append(ControlExample.getResourceString("PrintDialog") + Text.DELIMITER);
      textWidget.append(ControlExample.getResourceString("Result", new String[] { "" + result }) + Text.DELIMITER
          + Text.DELIMITER);
      return;
    }
View Full Code Here

    if (name.equals(ControlExample.getResourceString("MessageBox"))) {
      MessageBox dialog = new MessageBox(shell, style);
      dialog.setMessage(ControlExample.getResourceString("Example_string"));
      dialog.setText(ControlExample.getResourceString("Title"));
      int result = dialog.open();
      textWidget.append(ControlExample.getResourceString("MessageBox") + Text.DELIMITER);
      /*
       * The resulting integer depends on the original dialog style. Decode the result and display it.
       */
      switch (result) {
View Full Code Here

      return;
    }

    final PrintDialog dialog= new PrintDialog(shell, SWT.PRIMARY_MODAL);
    dialog.setPrinterData(fgPrinterData);
    final PrinterData data= dialog.open();

    if (data != null) {
      final Printer printer= new Printer(data);
      final Runnable styledTextPrinter= fTextWidget.print(printer, options);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.