Package java.awt.print

Examples of java.awt.print.PrinterJob.printDialog()


    } // c'tor

    public void actionPerformed(ActionEvent ae) {
        PrinterJob printJob = PrinterJob.getPrinterJob();
        printJob.setPrintable(m_GraphPanel);
        if (printJob.printDialog())
          try {
          m_bIsPrinting = true;
            printJob.print();
        m_bIsPrinting = false;
          } catch(PrinterException pe) {
View Full Code Here


            }});
        menu.add(new AbstractAction("Print") {
            public void actionPerformed(ActionEvent e) {
                    PrinterJob printJob = PrinterJob.getPrinterJob();
                    printJob.setPrintable(demo);
                    if (printJob.printDialog()) {
                        try {
                            printJob.print();
                        } catch (Exception ex) {
                            ex.printStackTrace();
                        }
View Full Code Here

    //  job.getPrintService().addPrintServiceAttributeListener(this);
      job.setPageable(m_layout.getPageable(false))//  no copy
    //  Dialog
      try
      {
        if (m_info.isWithDialog() && !job.printDialog(prats))
          return;
      }
      catch (Exception e)
      {
        log.log(Level.WARNING, "Operating System Print Issue, check & try again", e);
View Full Code Here

        }
    }

    public void printFile() {
        PrinterJob job = PrinterJob.getPrinterJob();
        if (job.printDialog()) {
            try {
//                PrintJob myJob = imageArea.getToolkit().getPrintJob(null, fileName, null);
//                if (myJob != null) {
                job.setPrintable(new Printable() {
View Full Code Here

            pjob.setJobName(jobName);
            final Book book = new Book();
            book.append(printPages, pf, pdfFile.getNumPages());
            pjob.setPageable(book); // Send print job to default printer
            if (pjob.printDialog()) {
                pjob.print();
                return true;
            }
            return false;
        } catch (final Exception ex) {
View Full Code Here

                public void actionPerformed(ActionEvent e) {
                   
                    PrinterJob printerJob = PrinterJob.getPrinterJob();
           
                    if (printerJob.printDialog()) {

                        try {
                            printerJob.setPrintable(viewerPane);
                            printerJob.print();
                   
View Full Code Here

            pj.setCopies(numOfCopies);
            pj.setJobName(patientName + " by Dolphin");
            pj.setPrintable(this, pageFormat);

            if (useDialog) {
                if (pj.printDialog()) {
                    try {
                        pj.print();
                    } catch (PrinterException printErr) {
                        printErr.printStackTrace();
                    }
View Full Code Here

     * Calling the printDialog will pop up the Printing Dialog. If you want to
     * print without user confirmation, you can directly call printerJob.print()
     *
     * doPrint will be false, if the user cancels the print operation.
     */
    boolean doPrint = printerJob.printDialog();

    if (doPrint) {
      try {
        printerJob.print();
      } catch (PrinterException ex) {
View Full Code Here

        PrinterJob job = PrinterJob.getPrinterJob();
        PageFormat pf = job.defaultPage();
        PageFormat pf2 = job.pageDialog(pf);
        if (pf2 != pf) {
            job.setPrintable(this, pf2);
            if (job.printDialog()) {
                try {
                    job.print();
                }
                catch (PrinterException e) {
                    JOptionPane.showMessageDialog(this, e);
View Full Code Here

//    }

    printerJob.setJobName(jobName);
    printerJob.setPageable(document);
    printerJob.setCopies(getNumberOfCopies(reportConfiguration));
    if (printerJob.printDialog())
    {
      printerJob.print();
      return true;
    }
    return false;
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.