Class JsonTreeCellRenderer

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

public class JsonTreeCellRenderer extends DefaultTreeCellRenderer
Cell renderer for the JSON tree that applies the same dark-theme color palette used by the raw-text pane.

Color mapping

JSON tree renderer color mapping
KindKey colorValue color
ROOT plain (JsonRawPane.COLOR_PLAIN)
KEY / array index with children JsonRawPane.COLOR_KEY bold JsonRawPane.COLOR_STRUCTURAL (the size summary)
STRING JsonRawPane.COLOR_KEY JsonRawPane.COLOR_STRING
NUMBER JsonRawPane.COLOR_KEY JsonRawPane.COLOR_NUMBER
BOOLEAN JsonRawPane.COLOR_KEY JsonRawPane.COLOR_BOOLEAN
NULL JsonRawPane.COLOR_KEY JsonRawPane.COLOR_NULL italic

Implementation note

DefaultTreeCellRenderer is a JLabel subclass. We configure the label's text using an HTML snippet so that key and value can be styled with independent colors inside a single label — no second component is needed. The HTML is kept intentionally minimal (inline <font> and <b> tags only) to avoid the overhead of the full CSS engine.

Selection and focus decorations are preserved by delegating to super.getTreeCellRendererComponent first and then overriding only the text.

See Also:
  • Constructor Details

    • JsonTreeCellRenderer

      public JsonTreeCellRenderer()
      Create a JsonTreeCellRenderer and configure the default background and icon colors for the dark theme.
  • Method Details