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

Changing tree renderer font doesn't invalidate cached preferred sizes in UI

XMLWordPrintable



      Name: krT82822 Date: 01/18/99


      Changing the font of the tree cell renderer does not invalidate the UI's cached preferred sizes. All the cells come up with ...'s because the new size
      is larger (assuming a larger font)

      import javax.swing.*;
      import javax.swing.tree.*;
      import java.awt.*;
      import java.util.*;

      public class TreeChangedRenderer {
        public static void main(String args[]) {
          JFrame frame = new JFrame("Changed Renderer");
          JTree tree = new JTree();
          DefaultTreeCellRenderer renderer = (DefaultTreeCellRenderer)tree.getCellRenderer();
          renderer.setFont(new Font("Dialog", Font.BOLD | Font.ITALIC, 24));

          JScrollPane scrollPane = new JScrollPane(tree);
          frame.getContentPane().add(scrollPane, BorderLayout.CENTER);
          frame.setSize(300, 150);
          frame.setVisible(true);
        }
      }
      (Review ID: 52780)
      ======================================================================

            svioletsunw Scott Violet (Inactive)
            kryansunw Kevin Ryan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: