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

Regresssion: CustomMenuItem in submenu fires too often

    XMLWordPrintable

    Details

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

      Java 8u-dev repo tip, Linux

      Description

      I believe the fix for RT-37022 has caused a regression of issue RT-37021. Below is the same test class which run with the changeset for RT-37022 exhibits the same behaviour again of firing once for each time the menu has been shown.

      *********************************************** Test Class **********************************************************
      import javafx.application.Application;
      import javafx.event.ActionEvent;
      import javafx.event.EventHandler;
      import javafx.scene.Scene;
      import javafx.scene.control.CustomMenuItem;
      import javafx.scene.control.Label;
      import javafx.scene.control.Menu;
      import javafx.scene.control.MenuBar;
      import javafx.scene.layout.BorderPane;
      import javafx.stage.Stage;

      public class CustomMenuItemTest extends Application {

         @Override public void start(final Stage primaryStage) throws Exception {

            primaryStage.centerOnScreen();
            primaryStage.setHeight(350);
            primaryStage.setWidth(500);
              
            CustomMenuItem item = new CustomMenuItem(new Label("Testing"));
            item.setOnAction(new EventHandler<ActionEvent>() {
               @Override public void handle(ActionEvent event) {
                  System.out.println("testing fired!");
               }
            });
            final Menu submenu = new Menu("Sub Menu");
            submenu.getItems().add(item);
             
            Menu topMenu = new Menu("Top Menu");
            topMenu.getItems().add(submenu);
            MenuBar menuBar = new MenuBar();
            menuBar.getMenus().add(topMenu);
             
            BorderPane pane = new BorderPane();
            pane.setTop(menuBar);
             
            primaryStage.setScene( new Scene( pane ) );

            primaryStage.show();

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

      }

        Attachments

          Activity

            People

            Assignee:
            jgiles Jonathan Giles
            Reporter:
            csmithjfx Charles Smith (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported: