Class BasicSearchCellRenderer

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, TreeCellRenderer

public class BasicSearchCellRenderer extends JPanel implements TreeCellRenderer
Displays an search entry in a tree.
See Also:
  • Field Details

    • selected

      protected boolean selected
      Is the value currently selected.
    • textSelectionColor

      protected Color textSelectionColor
      Color to use for the foreground for selected nodes.
    • textNonSelectionColor

      protected Color textNonSelectionColor
      Color to use for the foreground for non-selected nodes.
    • backgroundSelectionColor

      protected Color backgroundSelectionColor
      Color to use for the background when a node is selected.
    • backgroundNonSelectionColor

      protected Color backgroundNonSelectionColor
      Color to use for the background when the node is not selected.
    • borderSelectionColor

      protected Color borderSelectionColor
      Color to use for the background when the node is not selected.
    • map

      protected Map map
      Map to use for rendering included images.
    • hits

      protected javax.help.plaf.basic.BasicSearchCellRenderer.ValueJLabel hits
      Hits
    • quality

      protected javax.help.plaf.basic.BasicSearchCellRenderer.ValueJLabel quality
      Quality
    • title

      protected JLabel title
      Title
  • Constructor Details

    • BasicSearchCellRenderer

      public BasicSearchCellRenderer(Map map)
      Returns a new instance of BasicSearchCellRender. Left alignment is set. Icons and text color are determined from the UIManager.
  • Method Details

    • setTextSelectionColor

      public void setTextSelectionColor(Color newColor)
      Sets the color the text is drawn with when the node is selected.
    • getTextSelectionColor

      public Color getTextSelectionColor()
      Returns the color the text is drawn with when the node is selected.
    • setTextNonSelectionColor

      public void setTextNonSelectionColor(Color newColor)
      Sets the color the text is drawn with when the node is not selected.
    • getTextNonSelectionColor

      public Color getTextNonSelectionColor()
      Returns the color the text is drawn with when the node is not selected.
    • setBackgroundSelectionColor

      public void setBackgroundSelectionColor(Color newColor)
      Sets the color to use for the background if the node is selected.
    • getBackgroundSelectionColor

      public Color getBackgroundSelectionColor()
      Returns the color to use for the background if the node is selected.
    • setBackgroundNonSelectionColor

      public void setBackgroundNonSelectionColor(Color newColor)
      Sets the background color to be used for unselected nodes.
    • getBackgroundNonSelectionColor

      public Color getBackgroundNonSelectionColor()
      Returns the background color to be used for unselected nodes.
    • setBorderSelectionColor

      public void setBorderSelectionColor(Color newColor)
      Sets the color to use for the border.
    • getBorderSelectionColor

      public Color getBorderSelectionColor()
      Returns the the border color.
    • setFont

      public void setFont(Font font)
      Subclassed to only accept the font if it is not a FontUIResource.
      Overrides:
      setFont in class JComponent
    • setBackground

      public void setBackground(Color color)
      Subclassed to only accept the color if it is not a ColorUIResource.
      Overrides:
      setBackground in class JComponent
    • getTreeCellRendererComponent

      public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus)
      Configures the renderer based on the components passed in. Sets the value from messaging value with toString(). The foreground color is set based on the selection and the icon is set based on on leaf and expanded.
      Specified by:
      getTreeCellRendererComponent in interface TreeCellRenderer
    • paint

      public void paint(Graphics g)
      Paints the value. The background is filled based on selected color.
      Overrides:
      paint in class JComponent
    • getPreferredSize

      public Dimension getPreferredSize()
      Overrides JComponent.getPreferredSize to return slightly taller preferred size value.
      Overrides:
      getPreferredSize in class JComponent