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

[ContextMenu] focus can become fixed, or can disappear.

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Cannot Reproduce
    • Affects Version/s: 7u6
    • Fix Version/s: 8u20
    • Component/s: javafx
    • Labels:
    • Environment:

      2.2.0b11, JDK7, x32, j2d and d3d, win7

      Description

      I've attached a movie. There are actually two issues, but I don't know, whether they are different.

      One issue: at some moment I cannot move focus.
      The second: at some moment focus is replaced by white text applying.

      Code:

      import javafx.application.Application;
      import javafx.event.EventHandler;
      import javafx.geometry.Side;
      import javafx.scene.Scene;
      import javafx.scene.control.ContextMenu;
      import javafx.scene.control.Label;
      import javafx.scene.control.MenuItem;
      import javafx.scene.input.MouseEvent;
      import javafx.scene.layout.Pane;
      import javafx.scene.layout.VBox;
      import javafx.stage.Stage;

      public class JavaApplication41 extends Application {

          @Override
          public void start(Stage stage) {
              VBox root = new VBox();


              Pane test_pane = new Pane();
              test_pane.setPrefSize(600, 300);
              test_pane.setMaxSize(600, 300);
              root.getChildren().add(test_pane);

              final ContextMenu menu = new ContextMenu();
              final Label menu_label = new Label("Menu");
              menu_label.setOnMouseReleased(new EventHandler<MouseEvent>() {

                  @Override
                  public void handle(MouseEvent t) {
                      if (menu.isShowing()) {
                          System.out.println("hide");
                          menu.hide();
                      } else {
                          System.out.println("show");
                          menu.show(menu_label, Side.BOTTOM, 0, 0);
                      }
                  }
              });

              test_pane.getChildren().add(menu_label);

              reset(menu);

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

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

          protected void reset(ContextMenu menu) {
              menu.getItems().clear();
              for (int i = 0; i < 3; i++) {
                  menu.getItems().add(new MenuItem("Menu item" + i));
              }
          }
      }

        Attachments

          Activity

            People

            • Assignee:
              jgiles Jonathan Giles
              Reporter:
              akirov Alexander Kirov (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported: