Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: for the plan.

Jump to: navigation, search

Nebula PromptSupport

< Back to Nebula Main Page



See for a description of the Input Prompt pattern or for guidelines of how to use prompts in Windows Vista.

This work is inpired by the project XSwingX ( by Peter Weishapl.


Add a Prompt to Your Existing Text Component

Just invoke

PromptSupport.setPrompt("Prompt Text", control);

Where control is an instance of a Text, a StyledText, a Combo or a CCombo widget.

Customize the Prompt

Focus Behavior

By default, the prompt text will be hidden, when the text component is focused:

Textfield xp focused hidden.png

This behavior can be customized with the PromptSupport.setFocusBehavior() method. The prompt text can be hidden or highlighted when the widget gets the focus (and no text is entered), as indicated in the screenshots below.


Textfield xp focused hidden.png


Textfield xp focused highlighted.png

Font Style and Color

The font of the prompt text by default is the same as the text component's font, but sometimes you want the prompt text to be different. You can make the prompt text plain, bold, italic, or both bold and italic with the PromptSupport.setFontStyle() method.


Textfield xp.png


Textfield xp italic.png


Textfield xp bold.png


Textfield xp bolditalic.png

By default, the color used for the prompt text is the text component's disabled text color, but yout can change this with the PromptSupport.setForeground()</code method. <code>PromptSupport.setForeground(Color.RED) gives you:

Textfield xp red.png

You can also set a background color for the promp by calling PromptSupport.setBackground().


An example called is located in the plugin org.eclipse.nebula.widgets.opal.promptsupport.snippets.

This example is also available here :

Copyright © Eclipse Foundation, Inc. All Rights Reserved.