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

MenuItem objects return null if they are activated by shortcut

XMLWordPrintable

    • 1.2.2
    • generic, x86, sparc
    • generic, solaris_2.6, windows_nt



      Name: joT67522 Date: 09/16/97


      The MenuItem class should also return the label of the menu item
      in the ActionEvent if it is activated and if there is no
      action command specified for it.
      However, this is not the case, if the menu item is activated
      through the menu shortcut.
      I've went through the source code that is part of the JDK 1.1.3
      and found the error in the method handleShortcut of the MenuItem
      class. Instead of:

        if (e.getID() == KeyEvent.KEY_PRESSED) {
          Toolkit.getEventQueue().postEvent(
            new ActionEvent(this, ActionEvent.ACTION_PERFORMED,
                            actionCommand));
                            ^^^^^^^^^^^^^
        ...

      there should be:

        if (e.getID() == KeyEvent.KEY_PRESSED) {
          Toolkit.getEventQueue().postEvent(
            new ActionEvent(this, ActionEvent.ACTION_PERFORMED,
                            getActionCommand()));
                            ^^^^^^^^^^^^^^^^^^
        ...

      Keep on the good work!
      company - HERMES SoftLab , email - ###@###.###
      ======================================================================

            mbronsonsunw Mike Bronson (Inactive)
            johsunw Joon Oh (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: