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

Tree icon height is fixed in windows look-and-feel

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Not an Issue
    • Affects Version/s: 1.4.0
    • Fix Version/s: None
    • Component/s: client-libs
    • Labels:

      Description



      Name: sv35042 Date: 10/09/2002


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


      Microsoft Windows 2000 [Version 5.00.2195]

      A DESCRIPTION OF THE PROBLEM :
      When one uses a custom icon in a tree, the height is not
      adjusted so the icon is clipped.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the attached program.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      I expected to see the full icon. Instead, it is clipped.

      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.*;
      import javax.swing.*;
      import javax.swing.tree.*;
      import java.net.*;

      class TreeBug2 {
      public static void main(String[] args) throws Exception {
      ImageIcon image = new ImageIcon(new URL
      ("http://developer.java.sun.com/images/duke.wave.shadow.2.gif"));
      UIManager.setLookAndFeel
      ("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
      JFrame frame = new JFrame();
      JTree tree = new JTree(new String[]{"cell"});
      DefaultTreeCellRenderer cellRenderer = new
      DefaultTreeCellRenderer();
      cellRenderer.setLeafIcon(image);
      tree.setCellRenderer(cellRenderer);
      frame.getContentPane().add(tree,BorderLayout.CENTER);
      frame.pack();
      frame.setVisible(true);
      }
      }

      ---------- END SOURCE ----------
      (Review ID: 146021)
      ======================================================================

        Activity

        Hide
        svioletsunw Scott Violet (Inactive) added a comment -
        BT2:EVALUATION

        JTree can either query each cell for its preferred height, or assume they
        all have a certain size. The default is they all have the same size and
        therefore icon sizes will be igored. You could either up the row height,
        setRowHeight(>16) or setRowHeight(-1) which will trigger each cell's
        preferred size to be queried.
        ###@###.### 2002-10-18
        Show
        svioletsunw Scott Violet (Inactive) added a comment - BT2:EVALUATION JTree can either query each cell for its preferred height, or assume they all have a certain size. The default is they all have the same size and therefore icon sizes will be igored. You could either up the row height, setRowHeight(>16) or setRowHeight(-1) which will trigger each cell's preferred size to be queried. ###@###.### 2002-10-18

          People

          • Assignee:
            svioletsunw Scott Violet (Inactive)
            Reporter:
            svioletsunw Scott Violet (Inactive)
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Imported:
              Indexed: