public void paintIcon(Component c, Graphics g, int x, int y) { if (!(g instanceof Graphics2D)) { return; } // The following check is here because some applications // (like JIDE's ExpandablePanel) may decide to use the // "Tree.collapsedIcon" and "Tree.expandedIcon" UIManager // entries to paint on non-JTree components. Sigh. JTree tree = (c instanceof JTree) ? (JTree) c : null; Icon iconToDraw = TreeIcon.getIcon(tree, this.isCollapsed); iconToDraw.paintIcon(c, g, x, y); }
@Override public void paintIcon(Component c, Graphics g, int x, int y) { if (!(g instanceof Graphics2D)) { return; } // The following check is here because some applications // (like JIDE's ExpandablePanel) may decide to use the // "Tree.collapsedIcon" and "Tree.expandedIcon" UIManager // entries to paint on non-JTree components. Sigh. JTree tree = (c instanceof JTree) ? (JTree) c : null; Icon iconToDraw = TreeIcon.getIcon(tree, this.isCollapsed); iconToDraw.paintIcon(c, g, x, y); }