0

I have KeyEvent.KEY_TYPED on my TextFields. If user pastes data with keyboard shortcut, event gets triggered. But it doesn't work if user pastes with right click on mouse. I found this solution that solves this issue. But I have many TextFields, can I override method for all TextFields at once, but only for current class I'm working on?

Alyona
  • 1,362
  • 2
  • 17
  • 32

1 Answers1

1
public class NewTextField extends TextField {
     @Override
    public void paste() {
        super.paste();
        System.out.println("text pasted in");
    }
}

Use NewTextField as the textfield you want to have your paste feature.

THe_strOX
  • 667
  • 1
  • 5
  • 15