コード例 #1
1
 /** Creates the error area component. */
 private void initErrorArea() {
   SimpleAttributeSet attribs = new SimpleAttributeSet();
   StyleConstants.setAlignment(attribs, StyleConstants.ALIGN_RIGHT);
   StyleConstants.setFontFamily(attribs, errorPane.getFont().getFamily());
   StyleConstants.setForeground(attribs, Color.RED);
   errorPane.setParagraphAttributes(attribs, true);
   errorPane.setPreferredSize(new Dimension(100, 50));
   errorPane.setMinimumSize(new Dimension(100, 50));
   errorPane.setOpaque(false);
 }
コード例 #2
0
  /**
   * Shows the given error message.
   *
   * @param text the text of the error
   */
  private void showErrorMessage(String text) {
    errorPane.setText(text);

    if (errorPane.getParent() == null) add(errorPane, BorderLayout.NORTH);

    SwingUtilities.getWindowAncestor(CreateSip2SipAccountForm.this).pack();
  }
コード例 #3
0
  /** Clears all the data previously entered in the form. */
  public void clear() {
    usernameField.setText("");
    displayNameField.setText("");
    passField.setText("");
    retypePassField.setText("");
    emailField.setText("");
    errorPane.setText("");

    remove(errorPane);
  }