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

JMenuItem doesn't extract tooltip text from its action object

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 1.3.0
    • Fix Version/s: None
    • Component/s: client-libs
    • Subcomponent:
    • CPU:
      generic, x86
    • OS:
      generic, windows_nt

      Description



      Name: rl16235 Date: 06/21/2000


      java version "1.3.0rc2"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0rc2-Y)
      Java HotSpot(TM) Client VM (build 1.3.0rc2-Y, mixed mode)

      JMenuItem does not use the tooltip text supplied with the Action object
      assigned to the menu item. Normally, components set the tooltip text with the
      Action's "SHORT_DESCRIPTION" parameter. JMenuItem seems to be the one which
      misses this feature. However you're still able to set the tolltip using the
      item.setToolTipText() method.

      The most surprising thing is that JMenuItem's superclass AbstractButton DOES
      have the code which extracts tooltip text from an Action object (see the
      configurePropertiesFromAction() method), but the JMenuItem class overrides this
      method to do exactly the same except for setting the tooltip text. I don't
      understand the reason for that.

      Here's a piece of AbstractButton.java:

      protected void configurePropertiesFromAction(Action a) {
          setText((a!=null?(String)a.getValue(Action.NAME):null));
          setIcon((a!=null?(Icon)a.getValue(Action.SMALL_ICON):null));
          setEnabled((a!=null?a.isEnabled():true));

          // DP: the following line is missing in JMenuItem.java
          setToolTipText((a!=null?(String)a.getValue(Action.SHORT_DESCRIPTION):null));

          if (a != null) {
              Integer i = (Integer)a.getValue(Action.MNEMONIC_KEY);
              if (i != null)
                  setMnemonic(i.intValue());
          }
      }

      ###@###.### 2000-06-21
       Could be related to bug id: 4238727. This is closed as will not fix.
      Opening anew bug report.
      (Review ID: 103485)
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                apikalev Andrey Pikalev
                Reporter:
                rlingaiaorcl Ranjit Lingaiah (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: