0

I'm trying to create one search toolbar that appears inside the letters hidden stick. when I press the hidden letters that when the bar disappears and there's no hiding the letters that appear. I've tried to capture events keyPressed entering the search bar, but I do not really feel comfortable with that way. if anyone has a better way, I hope everyone helps do.cam Thanks!

photo illustration

enter image description here

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433

1 Answers1

1

Check out the Text Prompt.

You can control when the prompt disappears. You can also control the color and style of prompt.

The Text Prompt uses a DocumentListener and a FocusListener to determine when the prompt should be displayed.

You can use the default settings with a single line of code:

JTextField textField = new JTextField(10);
TextPrompt tp7 = new TextPrompt("First Name", textField);
camickr
  • 321,443
  • 19
  • 166
  • 288