Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java suggestion field (auto completion)

 
Rus Corina
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Here is a small test program, hope it works. The file found in the link above must be in the same project
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic