With the release of SwingX 1.6.1, we now have a milestone release that contains the PromptSupport code. So, what are prompts? They are decorations to empty text components that usually provide a clue on how to use the component. Search fields containing a "Search" prompt, etc. Here, I provide a couple of examples on how to use the new SwingX code as well as a runnable application below.
PromptSupport has a rather small API of only 13 methods; most of which are not needed on a daily basis. There are two entry points for PromptSupport: setPrompt andsetBackgroudPainter. Unless one of these is called no prompt painting will be performed. Let's discuss each of the configurable prompts options and their defaults.
This is how the prompt reacts when the prompted component gains and looses focus.
HIDE,which hides the prompt when the component gains focus. This is the default behavior.
SHOW,which shows the prompt until the user types something.
HIGHLIGHT,which highlights the prompt text as though it were auto-selected.
Alters the font by making it bold, Italic, orbold Italic. The default is to show the font unchanged.