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

[SplitMenuButton] Right-click on the drop-down arrow opens popup and context menu simultaneously.

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 8
    • Fix Version/s: 8
    • Component/s: javafx
    • Environment:

      jdk 1.8.0 - b62

      Description

      To reproduce right-click the arrow.
      See that the popup and the context menu open simultaneously.


      import javafx.application.Application;
      import javafx.event.EventHandler;
      import javafx.scene.Scene;
      import javafx.scene.control.ContextMenu;
      import javafx.scene.control.MenuItem;
      import javafx.scene.control.SplitMenuButton;
      import javafx.scene.input.ContextMenuEvent;
      import javafx.scene.layout.HBox;
      import javafx.stage.Stage;

      public class BugSplitMenuButtonContextMenu extends Application {

          SplitMenuButton testedControl;

          @Override
          public void start(Stage stage) {

              testedControl = new SplitMenuButton();
              for (int i = 0; i < 5; i++) {
                  testedControl.getItems().add(new MenuItem("Menu item " + i));
              }
              
              final ContextMenu contextMenu = new ContextMenu();
              for (int i = 0; i < 3; i++) {
                  contextMenu.getItems().add(new MenuItem("Menu item - " + i));
              }

              testedControl.setOnContextMenuRequested(new EventHandler<ContextMenuEvent>() {
                  @Override
                  public void handle(ContextMenuEvent t) {
                      contextMenu.show(testedControl, t.getScreenX(), t.getScreenY());
                  }
              });

              HBox root = new HBox(20d);
              root.getChildren().add(testedControl);

              Scene scene = new Scene(root, 300, 250);

              stage.setScene(scene);
              stage.setTitle(System.getProperty("java.runtime.version") + "; " + System.getProperty("javafx.runtime.version"));
              stage.show();
          }

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

      }

        Attachments

          Activity

            People

            • Assignee:
              jgiles Jonathan Giles
              Reporter:
              dzinkevi Dmitry Zinkevich (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Due:
                Created:
                Updated:
                Resolved:
                Imported: