0

I wanted to add a text prompt for my JFormattedTextField and I searched it on google on how I could do this. I got a lot of hits for the following code below but when I put it into my code in eclipse it doesn't recognize any of it. Can someone tell me why?

Here are two possible ways to add a text prompt:

  PromptSupport.setPrompt("prompt", textComponent);
  TextPrompt p = new TextPrompt("text", textComponent);

I got it from the following link: How to display a default message in JTextField java

Community
  • 1
  • 1
selena
  • 151
  • 13

1 Answers1

0

the most probable reasons why eclipse doesn't recognize any of these classes are because they are not a part of the JDK.

PromptSupport is a part of the XSwingX library. If you want to use this library for setting PromptText, you will have to download the jar and add it to the build path of the project.

I am not sure whether TextPrompt is the class XSwingX as well.

ItachiUchiha
  • 36,135
  • 10
  • 122
  • 176