Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SWT Autocomplete text box

Tags:

java

swt

I have a text box inside a form editor. I want it to display a subset of a list of strings as the user enters characters into the text box (if you are familiar with the google auto suggest feature, or the yahoo mail compose). Does anybody know where I could find these classes? A code snippet would be very useful. Thanks

like image 486
yog Avatar asked Sep 21 '26 18:09

yog


1 Answers

Assuming you can include JFace in your application you can use:

String [] proposals = new String [] {.... your proposals ....};

new AutoCompleteField(text, new TextContentAdapter(), proposals);

where text is your Text control.

You can change the proposals by calling the setProposals method of AutoCompleteField.

like image 171
greg-449 Avatar answered Sep 24 '26 07:09

greg-449



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!