java - jTextField loses focus on typing -


i trying put lost focus listener on jtextfield. however, function triggered when typing in text field.

one possible way, in opinion, start timer when focus lost. however, not sure if right way go.

any leads?

import java.awt.event.focusevent; import java.awt.event.focuslistener;  import javax.swing.jtextfield;  public class main {      public static void main(string args[]) {         final jtextfield textfield = new jtextfield();         textfield.addfocuslistener(new focuslistener() {              @override             public void focusgained(focusevent e) {                 //your code here             }              @override             public void focuslost(focusevent e) {                 joptionpane.showmessagedialog(null, "focus lost");             }         });      } } 


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -