Exemple #1
0
 /**
  * Sets the text of this text field.
  *
  * @param text the text to show in this text field
  */
 public void setText(String text) {
   if ((text == null || text.length() == 0) && !isFocusOwner()) setDefaultText();
   else {
     this.setForeground(foregroundColor);
     super.setText(text);
   }
 }
Exemple #2
0
 /** Clears the default text. */
 private void clearDefaultText() {
   if (super.getText().equals(defaultText)) {
     super.setText("");
     this.setForeground(foregroundColor);
   }
 }
Exemple #3
0
 /** Sets the default text. */
 private void setDefaultText() {
   super.setText(defaultText);
   this.setForeground(defaultTextColor);
 }