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

[Menu] showing property change listener is not called on showing by keyboard

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: fx2.1
    • Fix Version/s: 7u6
    • Component/s: javafx
    • Labels:
    • Environment:

      2.1.0b15

      Description

      Run attached code:


      import javafx.application.Application;
      import javafx.beans.value.ChangeListener;
      import javafx.beans.value.ObservableValue;
      import javafx.scene.Scene;
      import javafx.scene.control.CheckBox;
      import javafx.scene.control.Menu;
      import javafx.scene.control.MenuBar;
      import javafx.scene.control.MenuItem;
      import javafx.scene.layout.VBox;
      import javafx.stage.Stage;

      /**
       *
       * @author alexandr_kirov
       */
      public class MenuOnShown extends Application {

          public static void main(String[] args) {
              launch(args);
          }

          @Override
          public void start(Stage stage) {
              VBox vb = new VBox();
              MenuBar mb = new MenuBar();

              Menu menu = new Menu("Menu");
              mb.getMenus().add(menu);

              menu.getItems().clear();
              for (int i = 0; i < 5; i++) {
                  menu.getItems().add(new MenuItem("MENU_ITEM" + i));
              }

              final CheckBox cb = new CheckBox("showing");
              menu.showingProperty().addListener(new ChangeListener<Boolean>() {

                  public void changed(ObservableValue<? extends Boolean> ov, Boolean t, Boolean t1) {
                      System.out.println("shown?");
                      cb.selectedProperty().setValue(t1);
                  }
              });

              vb.getChildren().addAll(cb, mb);

              Scene scene = new Scene(vb, 300, 300);
              stage.setScene(scene);
              stage.show();
          }
      }

      On launch, focus is on checkBox.
      Press "Tab"
      Press "Space"
      you will see dropDown.

      But this
              menu.showingProperty().addListener(new ChangeListener<Boolean>() {
      is not called.

      Showing property is not reflect the currecnt state in such case.

      But if you use mouse, and click on menu, than listener will be called.

        Attachments

          Activity

            People

            • Assignee:
              psomashe Parvathi Somashekar (Inactive)
              Reporter:
              akirov Alexander Kirov (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported: