JSuggestField - The JTextField that makes suggestions

JSuggestField behaves like "Google Suggest", but you can use it in Java. It extends JTextField, adding special features. You can use it just like any other JComponent.

JSuggestField s = new JSuggestField(this, suggestData);

See the javadoc for details.

Archive contains the JSuggestField-class and an example. Tested with jre 1.6

» Download

version 0.3, using seperate matcher-thread now
Licensed under the GLPv3

hi, rakudave..

i tried your sample it is really very good.

but the problem is that size of suggestion dialog (poped up)
can not set samll, i.e width is too much large .

how do i make it small.

help

Use one of the following:

public void setPreferredSuggestSize(Dimension size)
public void setMinimumSuggestSize(Dimension size)
public void setMaximumSuggestSize(Dimension size)

How about a SWT example?

hi,
One problem i'm facing in use of your suggestion field is that ,
I am making GUI from Netbeans IDE's drang nad drop , so not able to use this SuggestTextField from palllete.,
and you have created your own Textfield by extending JTextField..

how can i overcome this ..
Thanks :)
pls help..

I've never used NetBeans, I use Eclipse, so I probably can't help you...

hi, IDE is not a problem (either Eclipse or NetBeans).
my problem is 'm not able to use from mantissa pallet,like drag from pallet an place it on form (GUI).
need you reply.

Hi. I discover a bug, when you scroll down the combobox with cursor arrow keys.

Thanks, fixed

A very nice code that easily helps to achieve the task.. but waht about resizing.. Can anybody help me..

Use the setPreferred/Maximum/MinimumSize()-Functions

I can't use it inside a JDialog, since I have no JFrame there to relate it to - that's a pity!

You should be able to replace Frame by Window, and then it should work with a JDialog. It just needs some kind of top-container to attach the drop-down to...

Thanks a lot! Works perfectly now!

hello, can I set the suggestion box so it will only display maximum 10 items? thx anyway

sure, you can put a simple counter in the run-method of the InterruptableMatcher (located at the bottom of JSuggestField.java) and abort the loop as soon as your counter hits 10...

HI rakudave,

I have added JSuggestField in an application but its not getting visible..... I have tried every possible way but in vain.....

can you send the code of the application you developed whose screenshot you have displayed above......

plz help,

thanks

open the .jar-file in an archive manager, the source classes are contained within