Example #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);
   }
 }
Example #2
0
 /** Clears the default text. */
 private void clearDefaultText() {
   if (super.getText().equals(defaultText)) {
     super.setText("");
     this.setForeground(foregroundColor);
   }
 }
Example #3
0
 /** Sets the default text. */
 private void setDefaultText() {
   super.setText(defaultText);
   this.setForeground(defaultTextColor);
 }