Example usage for javax.print.attribute.standard DialogTypeSelection COMMON

List of usage examples for javax.print.attribute.standard DialogTypeSelection COMMON

Introduction

In this page you can find the example usage for javax.print.attribute.standard DialogTypeSelection COMMON.

Prototype

DialogTypeSelection COMMON

To view the source code for javax.print.attribute.standard DialogTypeSelection COMMON.

Click Source Link

Document

The cross-platform print dialog should be used.

Usage

From source file:Test.java

public Test() {
    this.setSize(200, 100);
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    this.setLayout(new FlowLayout());

    JColorChooser.showDialog(this, null, Color.blue);
    JButton printDialogButton = new JButton("Print Dialog");
    printDialogButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            final PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet();
            attributes.add(DialogTypeSelection.COMMON);
            PrinterJob printJob = PrinterJob.getPrinterJob();
            printJob.printDialog(attributes);

        }//from  w ww  . j a v a2 s.  c  o m
    });
    this.add(printDialogButton);
}