Code to reproduce the issue:
import javafx.application.Application;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.scene.Scene;
import javafx.scene.control.TextField;
import javafx.stage.Stage;
public class Test7 extends Application
{
public static void main(final String[] args)
{
launch(args);
}
@Override
public void start(final Stage primaryStage) throws Exception
{
final TextField field = new TextField();
field.setPrefColumnCount(30);
field.setEditable(true);
field.focusedProperty().addListener(new ChangeListener<Boolean>()
{
@Override
public void changed(final ObservableValue<? extends Boolean> observable, final Boolean oldValue, final Boolean newValue)
{
System.out.println("focus: " + newValue);
}
});
primaryStage.setScene(new Scene(field));
primaryStage.show();
field.requestFocus();
}
}
There's a focused text field in a window. Minimizing the window using its "_" button causes the text field to lose its focus (see "focus: false" in console). Restoring the window makes the text field being focused again (see "focus: true" in console).
Minimizing the window by clicking its icon on the Windows taskbar makes the field lose and instantly regain its focus (the output is "focus: false focus: true").
This is related to RT-36089 and DTL-6679 as these are tickets describing invalid behavior of popup windows depending on correct focus behavior.