/**
   * @param owner the owner of this component
   * @param maxVersion the maximum version number which is valid
   */
  public CheckOutVersionDialog(Frame owner, int maxVersion) {
    super(owner, true);

    this.maxVersion = maxVersion;
    parentFrame = owner;

    versionTF = new JTextField(5);

    okButton = new JButton("Ok");
    okButton.addActionListener(this);

    JPanel versionPanel = new JPanel();
    JPanel buttonPanel = new JPanel();

    versionPanel.add(new JLabel("Version number to check out: "));
    versionPanel.add(versionTF);

    buttonPanel.add(okButton);

    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(versionPanel, BorderLayout.CENTER);
    getContentPane().add(buttonPanel, BorderLayout.SOUTH);

    setLocation((int) owner.getLocation().getX() + 100, (int) owner.getLocation().getY() + 100);
    pack();
  }
Example #2
0
 private void saveWindowState(String key, Frame frame) {
   if ((frame.getExtendedState() & Frame.MAXIMIZED_BOTH) == 0) {
     preferences.putInt(key + "-x", frame.getLocation().x);
     preferences.putInt(key + "-y", frame.getLocation().y);
     preferences.putInt(key + "-width", frame.getSize().width);
     preferences.putInt(key + "-height", frame.getSize().height);
   }
 }
Example #3
0
  public static void translateToScreen(Event event) {
    Assert.isTrue(event.target instanceof Component);

    Frame frame = getFrame((Component) event.target);
    event.translate(
        frame.getLocation().x + frame.getInsets().left,
        frame.getLocation().y + frame.getInsets().top);
  }
Example #4
0
  public MailDialog(Frame owner, String title, boolean modal) {
    super(owner, title, modal);

    Point p = owner.getLocation();
    this.setLocation(p.x + 50, p.y + 50);

    strings = ResourceBundle.getBundle("org.pegadi.maildialog.MailDialogStrings");

    createUI();
  }
Example #5
0
 void saveWindowLocations() {
   Frame frame = WindowManager.getFrame("B&C");
   if (frame != null) Prefs.saveLocation(ContrastAdjuster.LOC_KEY, frame.getLocation());
   frame = WindowManager.getFrame("Threshold");
   if (frame != null) Prefs.saveLocation(ThresholdAdjuster.LOC_KEY, frame.getLocation());
   frame = WindowManager.getFrame("Results");
   if (frame != null) {
     Prefs.saveLocation(TextWindow.LOC_KEY, frame.getLocation());
     Dimension d = frame.getSize();
     Prefs.set(TextWindow.WIDTH_KEY, d.width);
     Prefs.set(TextWindow.HEIGHT_KEY, d.height);
   }
   frame = WindowManager.getFrame("Log");
   if (frame != null) {
     Prefs.saveLocation(TextWindow.LOG_LOC_KEY, frame.getLocation());
     Dimension d = frame.getSize();
     Prefs.set(TextWindow.LOG_WIDTH_KEY, d.width);
     Prefs.set(TextWindow.LOG_HEIGHT_KEY, d.height);
   }
 }
Example #6
0
 /**
  * Centre the dialog box in the frame. This must be called after the size has been established,
  * i.e. after the buttons etc. are arranged and pack() is called
  */
 public void centreInFrame() {
   Dimension frame_size = parent.getSize();
   Point frame_location = parent.getLocation();
   int centre_x = frame_location.x + frame_size.width / 2;
   int centre_y = frame_location.y + frame_size.height / 2;
   ;
   int xloc = centre_x - this.getSize().width / 2;
   int yloc = centre_y - this.getSize().height / 2;
   this.setLocation(new Point(xloc, yloc));
   this.requestFocus();
 }
  public CustomAttachmentDialog(AttachmentHandlerProperties properties) {
    super(PlatformUI.MIRTH_FRAME);
    this.parent = PlatformUI.MIRTH_FRAME;
    initComponents();
    initPropertiesTable();

    attachmentHandlerProperties = properties;

    classNameField.setText(attachmentHandlerProperties.getClassName());
    classNameField.requestFocus();
    classNameField.addFocusListener(
        new FocusAdapter() {

          @Override
          public void focusGained(FocusEvent e) {
            if (initialFocus) {
              classNameField.setCaretPosition(0);
              initialFocus = false;
            }
          }
        });
    updatePropertiesTable(attachmentHandlerProperties.getProperties());

    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    setModal(true);
    Dimension dlgSize = getPreferredSize();
    Dimension frmSize = parent.getSize();
    Point loc = parent.getLocation();

    if ((frmSize.width == 0 && frmSize.height == 0) || (loc.x == 0 && loc.y == 0)) {
      setLocationRelativeTo(null);
    } else {
      setLocation(
          (frmSize.width - dlgSize.width) / 2 + loc.x,
          (frmSize.height - dlgSize.height) / 2 + loc.y);
    }

    setVisible(true);
  }
Example #8
0
  /** Creates new form UserDialog */
  public FirstLoginDialog(User currentUser) {
    super(PlatformUI.MIRTH_FRAME);
    this.parent = PlatformUI.MIRTH_FRAME;
    initComponents();
    finishButton.setEnabled(false);

    userEditPanel.setUser(this, currentUser);

    jLabel2.setForeground(UIConstants.HEADER_TITLE_TEXT_COLOR);
    setModal(true);

    setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);

    this.addWindowListener(
        new WindowAdapter() {

          public void windowClosing(WindowEvent e) {
            finishButtonActionPerformed(null);
          }
        });

    pack();
    Dimension dlgSize = getPreferredSize();
    Dimension frmSize = parent.getSize();
    Point loc = parent.getLocation();

    if ((frmSize.width == 0 && frmSize.height == 0) || (loc.x == 0 && loc.y == 0)) {
      setLocationRelativeTo(null);
    } else {
      setLocation(
          (frmSize.width - dlgSize.width) / 2 + loc.x,
          (frmSize.height - dlgSize.height) / 2 + loc.y);
    }

    usageStatsMoreInfoLabel.setToolTipText(UIConstants.PRIVACY_TOOLTIP);
    usageStatsMoreInfoLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));

    setVisible(true);
  }