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

REGRESSION: BasicTreeUI$Actions#putValue does not work

    XMLWordPrintable

Details

    Description

      FULL PRODUCT VERSION :
      java version "1.5.0_04"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)
      Java HotSpot(TM) Client VM (build 1.5.0_04-b05, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      javax.swing.plaf.basic.BasicTreeUI$Actions#putValue does not store anything (see code fragment):



      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      run following code

      tree = new JTree(node);
      ActionMap actionMap = tree.getActionMap();
      Action action = null;
      action = actionMap.get("selectFirst");
      action.putValue(Action.SMALL_ICON,new
            ImageIcon(getClass().getResource("/pic/Home16.gif")));
      action.putValue(Action.SHORT_DESCRIPTION, "Home");
      action.putValue(Action.NAME, "Home");
      System.out.println(System.getProperty("java.version"));
      System.out.println(action);
      System.out.println(action.getValue(Action.SMALL_ICON));
      System.out.println(action.getValue(Action.NAME));
      System.out.println(action.getValue(Action.SHORT_DESCRIPTION));


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      ok with jre 1.4.2

      1.4.2_08
      javax.swing.plaf.basic.BasicTreeUI$TreeHomeAction@1595f51
      file:/C:/Projekte/Helpsystem/classes/pic/Home16.gif
      Home
      Home

      ACTUAL -
      bad result for 1.5

      1.5.0_04
      javax.swing.plaf.basic.BasicTreeUI$Actions@17ace8d
      null
      selectFirst
      null


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package de.herberlin.helpsystem.test;

      import javax.swing.Action;
      import javax.swing.ActionMap;
      import javax.swing.ImageIcon;
      import javax.swing.JTree;

      import junit.framework.TestCase;

      public class BasicTreeUiActionBugTest extends TestCase {

      public void testIt() throws Exception {

      JTree tree = new JTree();
      ActionMap actionMap = tree.getActionMap();
      Action action = null;
      action = actionMap.get("selectFirst");
      // action.putValue(Action.SMALL_ICON,new
      // ImageIcon(getClass().getResource("/pic/Home16.gif")));
      action.putValue(Action.SHORT_DESCRIPTION, "Home");
      action.putValue(Action.NAME, "Home");
      System.out.println(System.getProperty("java.version"));
      System.out.println(action);
      System.out.println(action.getValue(Action.SMALL_ICON));
      System.out.println(action.getValue(Action.NAME));
      System.out.println(action.getValue(Action.SHORT_DESCRIPTION));

      }
      }

      ---------- END SOURCE ----------

      Release Regression From : 1.4.2_08
      The above release value was the last known release where this
      bug was known to work. Since then there has been a regression.

      Attachments

        Activity

          People

            svioletsunw Scott Violet (Inactive)
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: