My favorites | Sign in
Project Logo
                
Search
for
Updated Jan 10, 2008 by petw2815
Labels: Featured
FAQ  

What is a 'prompt' and how should it be used?

See http://designinginterfaces.com/Input_Prompt for a description of the Input Prompt pattern or http://msdn2.microsoft.com/en-us/library/aa511494.aspx#prompts for guidelines of how to use prompts in Windows Vista.

What does 'buddy' mean in terms of child components?

Because the child is the buddy of the text field. Anyway, I believe I read about it somewhere in an older version of the Vista UX Guidelines (...make it the buddy of the text box...), but can't find it anymore. If you know a better name, please let me know.

Why should I use the prompt support provided by xswingx? I could easily write my own prompt support.

Well, that sounds pretty complicated, doesn't it? But it could be so easy: Just download prompt.jar (<10kB), add it to your classpath and call:

PromptSupport.setPrompt("My Prompt", myTextComponent);

Writing your own "prompt support" certainly requires both, more code and effort.

The prompt support is also very flexible. You can change the focus behavior (hide prompt, show prompt or highlight prompt), the prompt's color and even the font style (Italic, like it the Windows Vista search box, if you like). Of course you can change the prompt text too.

Most importantly, the prompt support doesn't modify your text component's Document. Therefore no unwanted DocumentEvents are fired and: getText always returns the real text - not the prompt!

So prompt support doesn't modify the text component's Document. How does it work, then?

PromptSupport uses JComponents client properties to get and set it's properties. Furthermore, the text component's UI delegate is wrapped by a custom delegate that reads these properties and renders the prompt accordingly. Read the code to learn more - it's even well documented!


Comment by Mkhululi.Tyukala, Nov 20, 2008

How do I solve this:;

Exception in thread "main" java.lang.NullPointerException?

at java.util.ResourceBundle?.getBundle(ResourceBundle?.java:962) at org.jdesktop.swingx.plaf.UIManagerExt$UIDefaultsExt.getResourceCache(UIManagerExt.java:85) at org.jdesktop.swingx.plaf.UIManagerExt$UIDefaultsExt.getFromResourceBundle(UIManagerExt.java:69) at org.jdesktop.swingx.plaf.UIManagerExt$UIDefaultsExt.access$000(UIManagerExt.java:39) at org.jdesktop.swingx.plaf.UIManagerExt.getString(UIManagerExt.java:150) at org.jdesktop.swingx.plaf.UIManagerExt.getString(UIManagerExt.java:143) at org.jdesktop.xswingx.JXSearchField.<init>(JXSearchField.java:161) at org.jdesktop.xswingx.demo.SearchFieldCustomizer?.initComponents(SearchFieldCustomizer?.java:40) at org.jdesktop.xswingx.demo.SearchFieldCustomizer?.<init>(SearchFieldCustomizer?.java:29) at org.jdesktop.xswingx.demo.Demo.main(Demo.java:40)

Comment by ge0ffrey.spam, Feb 04, 2009

xswingx 0.2.0 (the latest release) doesn't work with swingx 0.9.5 (the latest release), you need swingx 0.9.3. It would be nice if xswingx would be merged into swingx: in the issue it looks like they're waiting for a signed JCA, see https://swingx.dev.java.net/issues/show_bug.cgi?id=306

Comment by digz6666, May 04, 2009

xswingx 0.2.0 working with swingx 0.9.7.

Comment by digz6666, May 04, 2009

Is it possible to change recent searches text? I mean changing language.


Sign in to add a comment
Hosted by Google Code