コード例 #1
0
  /**
   * @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();
  }
コード例 #2
0
ファイル: MailDialog.java プロジェクト: dusken/pegadi
  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();
  }
コード例 #3
0
ファイル: HandyDialog.java プロジェクト: zhuzelong/basis
 /**
  * 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();
 }