コード例 #1
0
  /**
   * Shows this modal dialog.
   *
   * @param isVisible specifies whether we should be showing or hiding the window.
   */
  @Override
  public void setVisible(boolean isVisible) {
    this.pack();

    super.setVisible(isVisible);

    if (isVisible) {
      this.passwdField.requestFocus();
    }
  }
コード例 #2
0
  /**
   * Overwrites the setVisible method in order to set the position of this window before showing it.
   *
   * @param isVisible indicates if this frame should be visible
   */
  @Override
  public void setVisible(boolean isVisible) {
    if (isVisible) setLocationRelativeTo(null);

    super.setVisible(isVisible);
  }