aspose file tools*
The moose likes Beginning Java and the fly likes Java suggestion field (auto completion) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Java suggestion field (auto completion)" Watch "Java suggestion field (auto completion)" New topic
Author

Java suggestion field (auto completion)

Rus Corina
Ranch Hand

Joined: Jul 08, 2011
Posts: 90
Hello. I have a problem concerning a code I found on the internet about auto completion fields. The code is from this site: http://rakudave.ch/jsuggestfield. This is mainly a class which extends the JTextField component, and implements and autocompletion on it.

My program consists of a frame which has some regular text fields , 2 JSuggestFields and 2 buttons: add and ok. The button add makes the textfields editable. The ok button takes the data from the text and suggest fields, inserts it into a database, and then deletes the data from textfields (using setText("")) and makes them not editable. The JSuggestFields work just fine, but the problem appears when I hit the ok button: after the buttons become uneditable, the suggestion dialog appears on the screen, without positioning the mouse inside the suggest fields (the hideSuggestion method of the suggestField does not work). If somebody could help me and tell me what do I have to do in order to prevent the suggestion dialog to appear after clearing the suggestField, I would be really grateful
Rus Corina
Ranch Hand

Joined: Jul 08, 2011
Posts: 90


Here is a small test program, hope it works. The file found in the link above must be in the same project
 
wood burning stoves
 
subject: Java suggestion field (auto completion)