This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Java suggestion field (auto completion)" Watch "Java suggestion field (auto completion)" New topic

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: 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
It is sorta covered in the JavaRanch Style Guide.
subject: Java suggestion field (auto completion)
Similar Threads
Creating a masked popup in JavaScript
GUI Part - Bodgitt and Scarper
JDialog : Custom Input
Jquery Event Sequence
Refreshing the JFrame!!