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

  1. package reminderplugin;
  2.  
  3. import devplugin.Program;
  4. import java.awt.BorderLayout;
  5. import java.awt.FlowLayout;
  6. import java.awt.Font;
  7. import java.awt.Frame;
  8. import java.awt.GridLayout;
  9. import java.util.Properties;
  10. import javax.swing.BorderFactory;
  11. import javax.swing.BoxLayout;
  12. import javax.swing.JButton;
  13. import javax.swing.JCheckBox;
  14. import javax.swing.JComboBox;
  15. import javax.swing.JDialog;
  16. import javax.swing.JLabel;
  17. import javax.swing.JPanel;
  18. import util.ui.Localizer;
  19.  
  20. public class ReminderDialog extends JDialog {
  21.    private static final Localizer mLocalizer;
  22.    public static final String[] SMALL_REMIND_MSG_ARR;
  23.    private static final int[] SMALL_REMIND_VALUE_ARR;
  24.    private boolean mOkPressed = false;
  25.    private JComboBox mList;
  26.    private JCheckBox mRememberSettingsCb;
  27.    // $FF: synthetic field
  28.    static Class class$reminderplugin$ReminderDialog;
  29.  
  30.    public ReminderDialog(Frame parent, Program program, Properties settings) {
  31.       super(parent, true);
  32.       this.setTitle(mLocalizer.msg("title", "New reminder"));
  33.       JPanel contentPane = (JPanel)this.getContentPane();
  34.       contentPane.setLayout(new BorderLayout());
  35.       contentPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
  36.       JPanel northPn = new JPanel();
  37.       northPn.setLayout(new BoxLayout(northPn, 1));
  38.       JLabel titleLabel = new JLabel(program.getChannel().getName() + ": " + program.getTitle());
  39.       JPanel infoPanel = new JPanel(new GridLayout(2, 1));
  40.       Font font = titleLabel.getFont();
  41.       titleLabel.setFont(new Font(font.getName(), 1, font.getSize() + 4));
  42.       infoPanel.add(new JLabel(program.getDateString()));
  43.       infoPanel.add(new JLabel(program.getTimeString()));
  44.       JPanel headerPanel = new JPanel(new BorderLayout(20, 0));
  45.       headerPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
  46.       headerPanel.add(titleLabel, "West");
  47.       headerPanel.add(infoPanel, "East");
  48.       northPn.add(headerPanel);
  49.       this.mList = new JComboBox(SMALL_REMIND_MSG_ARR);
  50.       String s = settings.getProperty("defaultReminderEntry");
  51.       int reminderTime = 5;
  52.       if (s != null) {
  53.          try {
  54.             reminderTime = Integer.parseInt(s);
  55.          } catch (NumberFormatException var16) {
  56.          }
  57.       }
  58.  
  59.       if (reminderTime >= 0 && reminderTime < SMALL_REMIND_MSG_ARR.length) {
  60.          this.mList.setSelectedIndex(reminderTime);
  61.       } else {
  62.          this.mList.setSelectedIndex(5);
  63.       }
  64.  
  65.       northPn.add(this.mList);
  66.       this.mRememberSettingsCb = new JCheckBox(mLocalizer.msg("rememberSetting", "Remember setting"));
  67.       JPanel pn1 = new JPanel(new BorderLayout());
  68.       pn1.add(this.mRememberSettingsCb, "West");
  69.       northPn.add(pn1);
  70.       JPanel btnPn = new JPanel(new FlowLayout(4));
  71.       btnPn.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
  72.       JButton okBtn = new JButton(mLocalizer.msg("ok", "OK"));
  73.       okBtn.addActionListener(new 1(this, settings));
  74.       btnPn.add(okBtn);
  75.       this.getRootPane().setDefaultButton(okBtn);
  76.       JButton cancelBtn = new JButton(mLocalizer.msg("cancel", "Cancel"));
  77.       cancelBtn.addActionListener(new 2(this));
  78.       btnPn.add(cancelBtn);
  79.       contentPane.add(northPn, "North");
  80.       contentPane.add(btnPn, "South");
  81.       this.pack();
  82.    }
  83.  
  84.    public int getReminderMinutes() {
  85.       int idx = this.mList.getSelectedIndex();
  86.       return SMALL_REMIND_VALUE_ARR[idx];
  87.    }
  88.  
  89.    public boolean getOkPressed() {
  90.       return this.mOkPressed;
  91.    }
  92.  
  93.    // $FF: synthetic method
  94.    static Class class$(String x0) {
  95.       try {
  96.          return Class.forName(x0);
  97.       } catch (ClassNotFoundException x1) {
  98.          throw new NoClassDefFoundError(x1.getMessage());
  99.       }
  100.    }
  101.  
  102.    // $FF: synthetic method
  103.    static boolean access$002(ReminderDialog x0, boolean x1) {
  104.       return x0.mOkPressed = x1;
  105.    }
  106.  
  107.    // $FF: synthetic method
  108.    static JCheckBox access$100(ReminderDialog x0) {
  109.       return x0.mRememberSettingsCb;
  110.    }
  111.  
  112.    // $FF: synthetic method
  113.    static JComboBox access$200(ReminderDialog x0) {
  114.       return x0.mList;
  115.    }
  116.  
  117.    static {
  118.       mLocalizer = Localizer.getLocalizerFor(class$reminderplugin$ReminderDialog == null ? (class$reminderplugin$ReminderDialog = class$("reminderplugin.ReminderDialog")) : class$reminderplugin$ReminderDialog);
  119.       SMALL_REMIND_MSG_ARR = new String[ReminderFrame.REMIND_MSG_ARR.length - 1];
  120.       SMALL_REMIND_VALUE_ARR = new int[ReminderFrame.REMIND_VALUE_ARR.length - 1];
  121.       System.arraycopy(ReminderFrame.REMIND_MSG_ARR, 1, SMALL_REMIND_MSG_ARR, 0, SMALL_REMIND_MSG_ARR.length);
  122.       System.arraycopy(ReminderFrame.REMIND_VALUE_ARR, 1, SMALL_REMIND_VALUE_ARR, 0, SMALL_REMIND_VALUE_ARR.length);
  123.    }
  124. }
  125.