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

Action attached to a menu item of a sub-menu is not called by using the shortcut bound to it

    XMLWordPrintable

Details

    Description

      See attached code HelloMnemonic.java
      The menu bar has two entries and in each one there's an item which is bound to a shortcut defined with a letter + Ctrl + Alt:
      Menubar > File > Open : bound to Ctrl + Alt + A
      Menubar > Edit > Copy : bound to Ctrl + Alt + C
       
      All described below occurs the same with a simpler shortcut such as Ctrl + A.
      I run it and issue one time each of the two shortcuts; what gets printed is:

      menuitem1 got Event: javafx.event.ActionEvent[source=javafx.scene.control.MenuItem@28bb494b]
      menuitem7 got Event: javafx.event.ActionEvent[source=javafx.scene.control.MenuItem@58df0438]

      This is perfect each action associated to the menu item is called one time.

      Now I modifiy a little the code to move the Edit menu so that it becomes a sub menu of File (attached HelloMnemonicModified.java).
      We now have:
      Menubar > File > Open : bound to Ctrl + Alt + A
      Menubar > File > Edit > Copy : bound to Ctrl + Alt + C

      I run it and issue one time each of the two shortcuts; what gets printed is:
      menuitem1 got Event: javafx.event.ActionEvent[source=javafx.scene.control.MenuItem@298488ef]

      The action attached to menuitem7 is no longer called.

      Attachments

        Activity

          People

            psomashe Parvathi Somashekar (Inactive)
            yjoan Yves Joan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported: