diff options
author | Deepak Bhole <[email protected]> | 2010-12-06 15:34:01 -0500 |
---|---|---|
committer | Deepak Bhole <[email protected]> | 2010-12-06 15:34:01 -0500 |
commit | 6ca1a9a369b10703da9af8f8a1ced0f3b02ae5c2 (patch) | |
tree | 568f8e454db94fa8abc896b46ce8cac7a9f3b74d /netx/net/sourceforge/jnlp/services/XPrintService.java | |
parent | 0d66adf24179c33bbdccaacc10d4c8a5f5e2cd54 (diff) |
Fixed indentation and spacing for all .java files.
Added a new .settings directory which contains Eclipse
preferences for code style.
Diffstat (limited to 'netx/net/sourceforge/jnlp/services/XPrintService.java')
-rw-r--r-- | netx/net/sourceforge/jnlp/services/XPrintService.java | 120 |
1 files changed, 60 insertions, 60 deletions
diff --git a/netx/net/sourceforge/jnlp/services/XPrintService.java b/netx/net/sourceforge/jnlp/services/XPrintService.java index f2f75dd..ddbeb98 100644 --- a/netx/net/sourceforge/jnlp/services/XPrintService.java +++ b/netx/net/sourceforge/jnlp/services/XPrintService.java @@ -50,74 +50,74 @@ import net.sourceforge.jnlp.runtime.JNLPRuntime; public class XPrintService implements PrintService { - // If pj is null, then we do not have a printer to use. - private PrinterJob pj; - - public XPrintService() { - pj = PrinterJob.getPrinterJob(); + // If pj is null, then we do not have a printer to use. + private PrinterJob pj; + + public XPrintService() { + pj = PrinterJob.getPrinterJob(); + } + + public PageFormat getDefaultPage() { + if (pj != null) + return pj.defaultPage(); + else { + showWarning(); + return new PageFormat(); // might not have default settings. } - - public PageFormat getDefaultPage() { - if (pj != null) - return pj.defaultPage(); - else { - showWarning(); - return new PageFormat(); // might not have default settings. - } + } + + public PageFormat showPageFormatDialog(PageFormat page) { + if (pj != null) + return pj.pageDialog(page); + else { + showWarning(); + return page; } - public PageFormat showPageFormatDialog(PageFormat page) { - if (pj != null) - return pj.pageDialog(page); - else { - showWarning(); - return page; + } + + public boolean print(Pageable document) { + if (pj != null) { + pj.setPageable(document); + if (pj.printDialog()) { + try { + pj.print(); + return true; + } catch (PrinterException pe) { + System.err.println("Could not print: " + pe); + return false; + } + } + } else + showWarning(); + + return false; + } + + public boolean print(Printable painter) { + if (pj != null) { + pj.setPrintable(painter); + if (pj.printDialog()) { + try { + pj.print(); + return true; + } catch (PrinterException pe) { + System.err.println("Could not print: " + pe); + return false; } - } - - public boolean print(Pageable document) { - if (pj != null) { - pj.setPageable(document); - if (pj.printDialog()) { - try { - pj.print(); - return true; - } catch(PrinterException pe) { - System.err.println("Could not print: " + pe); - return false; - } - } - } else - showWarning(); - - return false; - } + } + } else + showWarning(); - public boolean print(Printable painter) { - if (pj != null) { - pj.setPrintable(painter); - if (pj.printDialog()) { - try { - pj.print(); - return true; - } catch(PrinterException pe) { - System.err.println("Could not print: " + pe); - return false; - } - - } - } else - showWarning(); - - return false; - } + return false; + } - private void showWarning() { - JOptionPane.showMessageDialog(null, + private void showWarning() { + JOptionPane.showMessageDialog(null, "Unable to find a default printer.", "Warning", JOptionPane.WARNING_MESSAGE); - System.err.println("Unable to print: Unable to find default printer."); - } + System.err.println("Unable to print: Unable to find default printer."); + } } |