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

MenuButton does not call the Action EventHandler (setOnAction is useless)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P4
    • tbd
    • 7u10
    • javafx
    • Windows 7 64-bit with Java 7u15 32-bit

    Description

      Adding an event handler for the action event on a MenuButton is useless because the event handler is never called.
      I want to dynamically create a context menu when the button is pressed rather than construct the menu items ahead of time. I choose to use a MenuButton to get the right look.

      Based on the code here http://docs.oracle.com/javafx/2/api/javafx/scene/control/ContextMenu.html
      which states "In this example, the context menu is shown when the user clicks on the Button (of course, you should use the MenuButton control to do this rather than doing the above)." - Note that the example there is also wrong, in that the code is using a TextField not a Button.
      I'm using a MenuButton. You can create a simple test case with the HelloWorld example that you get when you create a new NetBeans JavaFX Application project. Just changed the "Button" to a "MenuButton".

      Attachments

        Activity

          People

            Unassigned Unassigned
            swpalmer Scott Palmer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Imported: