 <p>I think it would be better if you create another class that can display a hint, that way it will be easier whenever you need to do this again. Here's an example of how it could work, taken from <a href="http://stackoverflow.com/questions/1738966/java-jtextfield-with-input-hint">another question on SO</a></p> <pre><code>class HintTextField extends JTextField implements FocusListener { private final String hint; private boolean showingHint; public HintTextField(final String hint) { super(hint); this.hint = hint; this.showingHint = true; super.addFocusListener(this); } @Override public void focusGained(FocusEvent e) { if(this.getText().isEmpty()) { super.setText(""); showingHint = false; } } @Override public void focusLost(FocusEvent e) { if(this.getText().isEmpty()) { super.setText(hint); showingHint = true; } } @Override public String getText() { return showingHint ? "" : super.getText(); } } </code></pre> <p>You can use this and then set your JTextField to <strong>new HintTextField("What you want your hint to be")</strong>. You can modify this class for your own needs, but it's a good starting point.</p> <p><strong>Update</strong>: And if you want to use your current code for whatever reason, change the mouse listener to a focus listener and override focusGained.</p>