Java examples for 2D Graphics:Print
Displaying the Page Format Dialog
import java.awt.print.PageFormat; import java.awt.print.PrinterJob; public class Main { public void m() throws Exception { PrinterJob pjob = PrinterJob.getPrinterJob(); // Get and change default page format settings if necessary. PageFormat pf = pjob.defaultPage(); pf.setOrientation(PageFormat.LANDSCAPE); // Show page format dialog with page format settings. pf = pjob.pageDialog(pf);//ww w. ja v a2s.co m } }