home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2005 June / PCpro_2005_06.ISO / files / opensource / tvbrowser / TvBrowser_1.0.exe / plugins / PrintPlugin.jar / printplugin / PrintPlugin.class (.txt) < prev    next >
Encoding:
Java Class File  |  2004-09-19  |  2.9 KB  |  70 lines

  1. package printplugin;
  2.  
  3. import devplugin.Plugin;
  4. import devplugin.PluginInfo;
  5. import devplugin.Version;
  6. import java.awt.print.PrinterException;
  7. import java.awt.print.PrinterJob;
  8. import java.util.Properties;
  9. import printplugin.dlgs.PrintDialog;
  10. import util.ui.Localizer;
  11. import util.ui.UiUtilities;
  12.  
  13. public class PrintPlugin extends Plugin {
  14.    private static final Localizer mLocalizer;
  15.    // $FF: synthetic field
  16.    static Class class$printplugin$PrintPlugin;
  17.  
  18.    public String getButtonIconName() {
  19.       return "printplugin/imgs/Print16.gif";
  20.    }
  21.  
  22.    public String getMarkIconName() {
  23.       return "printplugin/imgs/Print16.gif";
  24.    }
  25.  
  26.    public String getButtonText() {
  27.       return mLocalizer.msg("printProgram", "Print program");
  28.    }
  29.  
  30.    public PluginInfo getInfo() {
  31.       String name = mLocalizer.msg("printProgram", "Print program");
  32.       String desc = mLocalizer.msg("printdescription", "Allows printing programs.");
  33.       String author = "Robert Inzinger, Martin Oberhauser";
  34.       return new PluginInfo(name, desc, author, new Version(0, 5));
  35.    }
  36.  
  37.    public void execute() {
  38.       PrinterJob printJob = PrinterJob.getPrinterJob();
  39.       PrintDialog dlg = new PrintDialog(this.getParentFrame(), printJob);
  40.       UiUtilities.centerAndShow(dlg);
  41.       Printer printer = dlg.getPrinter();
  42.       if (printer != null) {
  43.          printJob.setPrintable(printer, dlg.getPageFormat());
  44.  
  45.          try {
  46.             printJob.print();
  47.          } catch (PrinterException e) {
  48.             e.printStackTrace();
  49.          }
  50.       }
  51.  
  52.    }
  53.  
  54.    public void loadSettings(Properties settings) {
  55.    }
  56.  
  57.    // $FF: synthetic method
  58.    static Class class$(String x0) {
  59.       try {
  60.          return Class.forName(x0);
  61.       } catch (ClassNotFoundException x1) {
  62.          throw new NoClassDefFoundError(x1.getMessage());
  63.       }
  64.    }
  65.  
  66.    static {
  67.       mLocalizer = Localizer.getLocalizerFor(class$printplugin$PrintPlugin == null ? (class$printplugin$PrintPlugin = class$("printplugin.PrintPlugin")) : class$printplugin$PrintPlugin);
  68.    }
  69. }
  70.