I have a JTextField with a Suggestion-Popup. A DocumentListener listen to all InsertUpdate-Events and check the Suggestion-List and open the Popup. If you click on a Suggestion-Entry in the Popup, the choosen Word will be set to the JTextField and the Popup closes. But this will fire a new InsertUpdate-Event and the Popup opens again.
I do not want to use a boolean flag or remove and add the Listener so often. Is there another way to prevent a DocumentEvent cycle? Or is there a Way to set the Text silently? I tryed:
this.getTextComponent().getDocument().insertString()
this.getTextComponent().setText()