Class GenericTreeCellRenderer

  • All Implemented Interfaces:
    javax.swing.tree.TreeCellRenderer

    public class GenericTreeCellRenderer
    extends java.lang.Object
    implements javax.swing.tree.TreeCellRenderer
    The GenericTreeCellRenderer implements TreeCellRenderer as a JLabel. The class gives simple methods to override for creating a custom renderer. A subclass can supply different logic for determining text, icon, color and font.
    Author:
    Jay Detwiler
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.awt.Color getBackground​(javax.swing.JTree tree, java.lang.Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus)  
      protected java.awt.Font getFont​(javax.swing.JTree tree, java.lang.Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus)  
      protected java.awt.Color getForeground​(javax.swing.JTree tree, java.lang.Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus)  
      protected javax.swing.Icon getIcon​(javax.swing.JTree tree, java.lang.Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus)  
      protected java.lang.String getText​(javax.swing.JTree tree, java.lang.Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus)  
      java.awt.Component getTreeCellRendererComponent​(javax.swing.JTree tree, java.lang.Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GenericTreeCellRenderer

        public GenericTreeCellRenderer()
    • Method Detail

      • getTreeCellRendererComponent

        public java.awt.Component getTreeCellRendererComponent​(javax.swing.JTree tree,
                                                               java.lang.Object value,
                                                               boolean selected,
                                                               boolean expanded,
                                                               boolean leaf,
                                                               int row,
                                                               boolean hasFocus)
        Specified by:
        getTreeCellRendererComponent in interface javax.swing.tree.TreeCellRenderer
      • getText

        protected java.lang.String getText​(javax.swing.JTree tree,
                                           java.lang.Object value,
                                           boolean selected,
                                           boolean expanded,
                                           boolean leaf,
                                           int row,
                                           boolean hasFocus)
      • getBackground

        protected java.awt.Color getBackground​(javax.swing.JTree tree,
                                               java.lang.Object value,
                                               boolean selected,
                                               boolean expanded,
                                               boolean leaf,
                                               int row,
                                               boolean hasFocus)
      • getForeground

        protected java.awt.Color getForeground​(javax.swing.JTree tree,
                                               java.lang.Object value,
                                               boolean selected,
                                               boolean expanded,
                                               boolean leaf,
                                               int row,
                                               boolean hasFocus)
      • getIcon

        protected javax.swing.Icon getIcon​(javax.swing.JTree tree,
                                           java.lang.Object value,
                                           boolean selected,
                                           boolean expanded,
                                           boolean leaf,
                                           int row,
                                           boolean hasFocus)
      • getFont

        protected java.awt.Font getFont​(javax.swing.JTree tree,
                                        java.lang.Object value,
                                        boolean selected,
                                        boolean expanded,
                                        boolean leaf,
                                        int row,
                                        boolean hasFocus)