Package com.lightcrafts.ui.print

Examples of com.lightcrafts.ui.print.PrintLayoutDialog


                // Last resort is default settings:
                layout = new PrintLayoutModel(size.width, size.height);
            }
        }
        // Show the layout dialog:
        final PrintLayoutDialog dialog = new PrintLayoutDialog(
            (BufferedImage) image, layout, frame, LOCALE.get("PrintDialogTitle")
        );
        // Hook up behaviors for the dialog buttons:
        dialog.addCancelAction(
            new ActionListener() {
                public void actionPerformed(ActionEvent event) {
                    dialog.dispose();
                    if (callback != null)
                        callback.done();
                }
            }
        );
        dialog.addDoneAction(
            new ActionListener() {
                public void actionPerformed(ActionEvent event) {
                    PrintLayoutModel layout = dialog.getPrintLayout();
                    doc.setPrintLayout(layout);
                    dialog.dispose();
                    if (callback != null)
                        callback.done();
                    LastPrintLayout = layout;
                    savePrefs();
                }
            }
        );
        dialog.addPrintAction(
            new ActionListener() {
                public void actionPerformed(ActionEvent event) {
                    PrintLayoutModel layout = dialog.getPrintLayout();
                    doc.setPrintLayout(layout);
                    printHeadless(frame, doc);
                    LastPrintLayout = layout;
                    savePrefs();
                }
            }
        );
        dialog.addPageSetupAction(
            new ActionListener() {
                public void actionPerformed(ActionEvent event) {
                    PrintLayoutModel layout = dialog.getPrintLayout();
                    doc.setPrintLayout(layout);
                    pageSetup(doc);
                    layout = doc.getPrintLayout();
                    PageFormat format = layout.getPageFormat();
                    dialog.setPageFormat(format);
                }
            }
        );
        PrinterLayer printer = Env.getPrinterLayer();
        printer.initialize();

        dialog.pack();
        dialog.setLocationRelativeTo(frame);
        dialog.setVisible(true);

        // dispose happens in PrintDoneCallback
        // printer.dispose();
    }
View Full Code Here

TOP

Related Classes of com.lightcrafts.ui.print.PrintLayoutDialog

Copyright © 2018 www.massapicom. 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.