nick
nick

Reputation: 249

vaadin flow TextFied focus listener

I would like to have a focus listener but the way I did it shows error in IDE. My code follows

  txtField.addFocusListener(event ->{
                        
      @Override
      public void focus() {
          System.out.println("Focus");
      }
   });

Can you tell me what I am making wrong?

Upvotes: 1

Views: 498

Answers (1)

Tatu Lund
Tatu Lund

Reputation: 10633

You are mixing up Java 6 and Java 8 syntaxes. You should just write

   txtField.addFocusListener(event -> {
       System.out.println("Focus");
   });

Upvotes: 3

Related Questions