javaswinginputjtextfieldhint

Java JTextField with input hint


I would like to add a hint value to my javax.swing.JTextField. It should look like Firefox rendering of <input type="text" title="bla">. This creates an edit field with the text 'bla' in the background. If the textbox has focus the title-text disappears and just reappears if the user leaves the editbox without text.

Is there a (free) swing component that does something like this?


Solution

  • Take a look at this one: http://code.google.com/p/xswingx/

    It is not very difficult to implement it by yourself, btw. A couple of listeners and custom renderer and voila.