Adil Adil - 2 months ago 14x
Java Question

RequestFocus in TextField doesn't work -JavaFX 2.1

I'm using JavaFX 2.1 and I'have created GUI using FXML, in the controller of this GUI I have added

, but always I get the focus in the first button that I have added to the GUI. I'm using Scene Builder 1.0.


At the time of initialize() controls are not yet ready to handle focus.

You can try next trick:

public void initialize(URL url, ResourceBundle rb) {
    Platform.runLater(new Runnable() {
        public void run() {