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

JTree support for selection-sensitive rendering is incomplete

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 8u162, 16, 17
    • client-libs
    • None

      The JTree architecture allows the rendering of a cell to be dependent upon whether the cell is selected or not. Using the default renderer, the selection state is passed to tree.convertValueToText(), which can use the selection state to return different text when the cell is selected. A custom renderer can use the selection state in arbitrary ways. The problem is that changes to the selection state do not invalidate the sizes of the affected cells. The result is that the rendering may exceed the size of the renderer component.

      Bug JDK-4506388 addressed this issue for custom renderers by saying that it was up to the custom renderer to solve the problem. However, this problem also arises for the default renderer when the text is customized by the JTree.

      I have run the attached test program using Metal and Aqua LAF. When selecting an item, sometimes the display is clipped and sometimes it is not, presumably depending upon exactly when the node dimensions were last calculated and cached.

            psadhukhan Prasanta Sadhukhan
            alans Alan Snyder
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: