0

I have created java swing application. In that application, there is a textfield.I have attached key listner for that text field also. Using that, enter key is identified and popup another JPanel. There is a JTable which is loaded data from DB and there is a JButton. The selected row from that table is loaded to that previous textfield.

There is a very rare issue with that implementation. when we have that JPanel, mistakenly the user pressed the enter button twice in very very short period at once. Then after we load that panel ther is a unusal behavior. by default the JButton is pressed without any key pressed.

According to my investigation, the problem can be solved, if we have a method to cler keylistner actions once it finished.

Are ther any methods?

  • Post [mcve] and show what you tried to clear the issue – c0der Nov 19 '17 at 11:30
  • Although I'm not sure if your approach will solve the problem. There is a queue in java where every event from AWT is queued, it is called [EventQueue](https://docs.oracle.com/javase/7/docs/api/java/awt/EventQueue.html). Also you may be intersted in this [question](https://stackoverflow.com/questions/37877195/how-to-insert-an-event-to-the-beginning-of-event-dispatch-thread-queue-in-java). – tur1ng Nov 19 '17 at 11:37

0 Answers0