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

CustomMenuItem: setHideOnClick(false) does not work for normal Menus

    XMLWordPrintable

Details

    Description

      Its seems, that hideOnClick does only work for ContextMenus, but not for normal Menus.
      Tested with 2.2 and 8.0 b84.

      See also this discussion:

      https://forums.oracle.com/forums/thread.jspa?messageID=10957982

      In this example, the menu hides on click, although I setHideOnClick(false).


      import javafx.application.Application;
      import javafx.beans.binding.Bindings;
      import javafx.scene.Scene;
      import javafx.scene.control.*;
      import javafx.scene.layout.BorderPane;
      import javafx.scene.layout.VBox;
      import javafx.stage.Stage;


      public class TestApp4 extends Application {

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

          @Override
          public void start(final Stage stage) throws Exception {
              VBox vBox = new VBox();
              MenuBar menuBar = new MenuBar();

              Menu menu = new Menu("test");

              CustomMenuItem customMenuItem = new CustomMenuItem(new Label("test"));
              customMenuItem.setHideOnClick(false);

              menu.getItems().add(customMenuItem);

              menuBar.getMenus().add(menu);

              vBox.getChildren().add(menuBar);
              Scene scene = new Scene(vBox);
              stage.setScene(scene);
              stage.show();
          }
      }

      Attachments

        Activity

          People

            psomashe Parvathi Somashekar (Inactive)
            cschudtjfx Christian Schudt (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported: