I would like to have a text box ( jTextField
) and that when starting the form in JAVA SWING in that text box an "informative" text appears on what to fill in that field. And that when clicking or inserting the first character that informative text disappears. I tried with setToolTipText
but what it does is when you hover over the jTextField
report, it doesn't add it to the Text box.
I tried with nombre.setText("Informativo");
but that way it has the default value, and when writing it adds it to the one it had. This is not useful for me.
What you want is some kind of placeholder . One solution is to use
TextPrompt
Rob Camick's class, which is very simple to use. Example:❍ Code:
❍ Output:
In..initComponents();