Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8095779

Invalid focus behavior when minimizing application using its taskbar icon (Windows)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • 8u20
    • 8u20
    • javafx
    • Windows 7 Pro SP1 x64, JDK 1.8.0_20-ea-b05

      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.

            anthony Anthony Petrov (Inactive)
            jsmucrjfx Jan Smucr (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: