Sometimes text fields will have a prototype value or label within the text field itself. For example:
- Safari's Google search field has the "Google" prototype value
- java.sun.com's search text field has the "Search" prototype value
- in Mac Address Book, the name fields have prototypes "First" and "Last"
SwingX should provide a simple class to make this easy. I'm going to attach my implementation of this
feature, which I'd love to see you guys add to SwingX. It's called "PrototypeValueSupport" and it works
with any JTextComponent. To use it, simply use the following code:
JTextField myTextField = ...
PrototypeValueSupport.install(myTextField, "Prototype Value");
It also conveniently greys out the prototype value, which is commonly done in this pattern.