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