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

Windows/Motif L&F: Bug with editable JTree

    Details

    • Subcomponent:
    • Resolved In Build:
      b10
    • CPU:
      generic, x86
    • OS:
      generic, windows_xp
    • Verification:
      Verified

      Description

      Bug with editable JTree and very easy to reproduce.
       
      0) Make sure you are using Windows or Motif Look and Feel (not reproducible with metal)
      1) Create a JTree and populate it with something.
      2) Make it editable by calling tree.setEditable(true);
      3) Start editing a leaf node.
       
      You will see that the icon on the left of the tree node moves up by a pixel. When you press Esc, to cancel editing, it moves back down. Do it several times and you will definitely see it. It's very disconcerting. It works on metal look and feel, suspect because the icon in that look and feel is much larger than in Motif and Windows.
       
      can be reproduced with JDK 5.0.6 and JDK 1.4.2.
       
      Is there any workaround? I did some debugging inside swing code, and indeed the code that calculates the Y position of the icon during editing (in DefaultTreeCellEditor.EditorContainer.paint()) calculates it to be 1, while the complicated code used in tree rendering (BasicLabelUI.layoutCL() computes it to be 2.
      The code in layoutCL was complicated and my debugging facilities are too limited for real debugging of Swing code, so I don't know why that happens.

        Attachments

          Activity

            People

            • Assignee:
              svioletsunw Scott Violet (Inactive)
              Reporter:
              tyao Ting-Yun Ingrid Yao (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: