RequestFocus in TextField doesn't work

后端 未结 6 1238
隐瞒了意图╮
隐瞒了意图╮ 2021-02-13 02:11

I use JavaFX 2.1 and I created GUI using FXML, in the controller of this GUI I added myTextField.requestFocus();.

But I always get the focus in the other co

6条回答
  •  青春惊慌失措
    2021-02-13 02:31

    The exact same answer as @Sergey Grinev. Make sure your version of java is up-to-date (JDK 1.8 or later).

    Platform.runLater(()->myTextField.requestFocus());
    

提交回复
热议问题