Java Code Examples for javax.swing.tree.DefaultTreeCellRenderer#setTextSelectionColor()

The following examples show how to use javax.swing.tree.DefaultTreeCellRenderer#setTextSelectionColor() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JTreeTable.java    From pcgen with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * updateUI is overridden to set the colors
 * of the Trees renderer to match that of the table.
 **/
@Override
public void updateUI()
{
	super.updateUI();

	// Make the tree's cell renderer use the
	// table's cell selection colors.
	TreeCellRenderer tcr = getCellRenderer();

	if (tcr instanceof DefaultTreeCellRenderer)
	{
		DefaultTreeCellRenderer dtcr = ((DefaultTreeCellRenderer) tcr);
		dtcr.setTextSelectionColor(UIManager.getColor("Table.selectionForeground")); //$NON-NLS-1$
		dtcr.setBackgroundSelectionColor(UIManager.getColor("Table.selectionBackground")); //$NON-NLS-1$
	}
}
 
Example 2
Source File: JTreeTable.java    From libreveris with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * updateUI is overridden to set the colors of the Tree's renderer to
 * match that of the table.
 */
@Override
public void updateUI ()
{
    super.updateUI();

    // Make the tree's cell renderer use the table's cell selection
    // colors.
    TreeCellRenderer tcr = getCellRenderer();

    if (tcr instanceof DefaultTreeCellRenderer) {
        DefaultTreeCellRenderer dtcr = ((DefaultTreeCellRenderer) tcr);

        // For 1.1 uncomment this, 1.2 has a bug that will cause an
        // exception to be thrown if the border selection color is
        // null.
        dtcr.setBorderSelectionColor(null);
        dtcr.setTextSelectionColor(
                UIManager.getColor("Table.selectionForeground"));
        dtcr.setBackgroundSelectionColor(
                UIManager.getColor("Table.selectionBackground"));
    }
}
 
Example 3
Source File: JTreeTable.java    From pcgen with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * updateUI is overridden to set the colors
 * of the Trees renderer to match that of the table.
 **/
@Override
public void updateUI()
{
	super.updateUI();

	// Make the tree's cell renderer use the
	// table's cell selection colors.
	TreeCellRenderer tcr = getCellRenderer();

	if (tcr instanceof DefaultTreeCellRenderer)
	{
		DefaultTreeCellRenderer dtcr = ((DefaultTreeCellRenderer) tcr);
		dtcr.setTextSelectionColor(UIManager.getColor("Table.selectionForeground")); //$NON-NLS-1$
		dtcr.setBackgroundSelectionColor(UIManager.getColor("Table.selectionBackground")); //$NON-NLS-1$
	}
}
 
Example 4
Source File: SeaGlassTreeUI.java    From seaglass with Apache License 2.0 5 votes vote down vote up
private void configureRenderer(SeaGlassContext context) {
    TreeCellRenderer renderer = tree.getCellRenderer();

    if (renderer instanceof DefaultTreeCellRenderer) {
        DefaultTreeCellRenderer r = (DefaultTreeCellRenderer) renderer;
        SeaGlassStyle style = (SeaGlassStyle)context.getStyle();

        context.setComponentState(ENABLED | SELECTED);
        Color color = r.getTextSelectionColor();
        if (color == null || (color instanceof UIResource)) {
            r.setTextSelectionColor(style.getColor(context, ColorType.TEXT_FOREGROUND));
        }
        color = r.getBackgroundSelectionColor();
        if (color == null || (color instanceof UIResource)) {
            r.setBackgroundSelectionColor(style.getColor(context, ColorType.TEXT_BACKGROUND));
        }

        context.setComponentState(ENABLED);
        color = r.getTextNonSelectionColor();
        if (color == null || color instanceof UIResource) {
            r.setTextNonSelectionColor(style.getColorForState(context, ColorType.TEXT_FOREGROUND));
        }
        color = r.getBackgroundNonSelectionColor();
        if (color == null || color instanceof UIResource) {
            r.setBackgroundNonSelectionColor(style.getColorForState(context, ColorType.TEXT_BACKGROUND));
        }
    }
}
 
Example 5
Source File: SynthTreeUI.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
private void configureRenderer(SynthContext context) {
    TreeCellRenderer renderer = tree.getCellRenderer();

    if (renderer instanceof DefaultTreeCellRenderer) {
        DefaultTreeCellRenderer r = (DefaultTreeCellRenderer)renderer;
        SynthStyle style = context.getStyle();

        context.setComponentState(ENABLED | SELECTED);
        Color color = r.getTextSelectionColor();
        if (color == null || (color instanceof UIResource)) {
            r.setTextSelectionColor(style.getColor(
                                 context, ColorType.TEXT_FOREGROUND));
        }
        color = r.getBackgroundSelectionColor();
        if (color == null || (color instanceof UIResource)) {
            r.setBackgroundSelectionColor(style.getColor(
                                    context, ColorType.TEXT_BACKGROUND));
        }

        context.setComponentState(ENABLED);
        color = r.getTextNonSelectionColor();
        if (color == null || color instanceof UIResource) {
            r.setTextNonSelectionColor(style.getColorForState(
                                    context, ColorType.TEXT_FOREGROUND));
        }
        color = r.getBackgroundNonSelectionColor();
        if (color == null || color instanceof UIResource) {
            r.setBackgroundNonSelectionColor(style.getColorForState(
                              context, ColorType.TEXT_BACKGROUND));
        }
    }
}
 
Example 6
Source File: SynthTreeUI.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private void configureRenderer(SynthContext context) {
    TreeCellRenderer renderer = tree.getCellRenderer();

    if (renderer instanceof DefaultTreeCellRenderer) {
        DefaultTreeCellRenderer r = (DefaultTreeCellRenderer)renderer;
        SynthStyle style = context.getStyle();

        context.setComponentState(ENABLED | SELECTED);
        Color color = r.getTextSelectionColor();
        if (color == null || (color instanceof UIResource)) {
            r.setTextSelectionColor(style.getColor(
                                 context, ColorType.TEXT_FOREGROUND));
        }
        color = r.getBackgroundSelectionColor();
        if (color == null || (color instanceof UIResource)) {
            r.setBackgroundSelectionColor(style.getColor(
                                    context, ColorType.TEXT_BACKGROUND));
        }

        context.setComponentState(ENABLED);
        color = r.getTextNonSelectionColor();
        if (color == null || color instanceof UIResource) {
            r.setTextNonSelectionColor(style.getColorForState(
                                    context, ColorType.TEXT_FOREGROUND));
        }
        color = r.getBackgroundNonSelectionColor();
        if (color == null || color instanceof UIResource) {
            r.setBackgroundNonSelectionColor(style.getColorForState(
                              context, ColorType.TEXT_BACKGROUND));
        }
    }
}
 
Example 7
Source File: JTreeTable.java    From opensim-gui with Apache License 2.0 5 votes vote down vote up
/**
 * updateUI is overridden to set the colors of the Tree's renderer
 * to match that of the table.
 */
public void updateUI() {
    super.updateUI();
    // Make the tree's cell renderer use the table's cell selection
    // colors.
    TreeCellRenderer tcr = getCellRenderer();
    if (tcr instanceof DefaultTreeCellRenderer) {
	DefaultTreeCellRenderer dtcr = ((DefaultTreeCellRenderer)tcr);
	// dtcr.setBorderSelectionColor(null);
	dtcr.setTextSelectionColor(UIManager.getColor
				   ("Table.selectionForeground"));
	dtcr.setBackgroundSelectionColor(UIManager.getColor
					("Table.selectionBackground"));
    }
}
 
Example 8
Source File: SynthTreeUI.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private void configureRenderer(SynthContext context) {
    TreeCellRenderer renderer = tree.getCellRenderer();

    if (renderer instanceof DefaultTreeCellRenderer) {
        DefaultTreeCellRenderer r = (DefaultTreeCellRenderer)renderer;
        SynthStyle style = context.getStyle();

        context.setComponentState(ENABLED | SELECTED);
        Color color = r.getTextSelectionColor();
        if (color == null || (color instanceof UIResource)) {
            r.setTextSelectionColor(style.getColor(
                                 context, ColorType.TEXT_FOREGROUND));
        }
        color = r.getBackgroundSelectionColor();
        if (color == null || (color instanceof UIResource)) {
            r.setBackgroundSelectionColor(style.getColor(
                                    context, ColorType.TEXT_BACKGROUND));
        }

        context.setComponentState(ENABLED);
        color = r.getTextNonSelectionColor();
        if (color == null || color instanceof UIResource) {
            r.setTextNonSelectionColor(style.getColorForState(
                                    context, ColorType.TEXT_FOREGROUND));
        }
        color = r.getBackgroundNonSelectionColor();
        if (color == null || color instanceof UIResource) {
            r.setBackgroundNonSelectionColor(style.getColorForState(
                              context, ColorType.TEXT_BACKGROUND));
        }
    }
}
 
Example 9
Source File: SynthTreeUI.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private void configureRenderer(SynthContext context) {
    TreeCellRenderer renderer = tree.getCellRenderer();

    if (renderer instanceof DefaultTreeCellRenderer) {
        DefaultTreeCellRenderer r = (DefaultTreeCellRenderer)renderer;
        SynthStyle style = context.getStyle();

        context.setComponentState(ENABLED | SELECTED);
        Color color = r.getTextSelectionColor();
        if (color == null || (color instanceof UIResource)) {
            r.setTextSelectionColor(style.getColor(
                                 context, ColorType.TEXT_FOREGROUND));
        }
        color = r.getBackgroundSelectionColor();
        if (color == null || (color instanceof UIResource)) {
            r.setBackgroundSelectionColor(style.getColor(
                                    context, ColorType.TEXT_BACKGROUND));
        }

        context.setComponentState(ENABLED);
        color = r.getTextNonSelectionColor();
        if (color == null || color instanceof UIResource) {
            r.setTextNonSelectionColor(style.getColorForState(
                                    context, ColorType.TEXT_FOREGROUND));
        }
        color = r.getBackgroundNonSelectionColor();
        if (color == null || color instanceof UIResource) {
            r.setBackgroundNonSelectionColor(style.getColorForState(
                              context, ColorType.TEXT_BACKGROUND));
        }
    }
}
 
Example 10
Source File: SynthTreeUI.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private void configureRenderer(SynthContext context) {
    TreeCellRenderer renderer = tree.getCellRenderer();

    if (renderer instanceof DefaultTreeCellRenderer) {
        DefaultTreeCellRenderer r = (DefaultTreeCellRenderer)renderer;
        SynthStyle style = context.getStyle();

        context.setComponentState(ENABLED | SELECTED);
        Color color = r.getTextSelectionColor();
        if (color == null || (color instanceof UIResource)) {
            r.setTextSelectionColor(style.getColor(
                                 context, ColorType.TEXT_FOREGROUND));
        }
        color = r.getBackgroundSelectionColor();
        if (color == null || (color instanceof UIResource)) {
            r.setBackgroundSelectionColor(style.getColor(
                                    context, ColorType.TEXT_BACKGROUND));
        }

        context.setComponentState(ENABLED);
        color = r.getTextNonSelectionColor();
        if (color == null || color instanceof UIResource) {
            r.setTextNonSelectionColor(style.getColorForState(
                                    context, ColorType.TEXT_FOREGROUND));
        }
        color = r.getBackgroundNonSelectionColor();
        if (color == null || color instanceof UIResource) {
            r.setBackgroundNonSelectionColor(style.getColorForState(
                              context, ColorType.TEXT_BACKGROUND));
        }
    }
}
 
Example 11
Source File: SynthTreeUI.java    From Java8CN with Apache License 2.0 5 votes vote down vote up
private void configureRenderer(SynthContext context) {
    TreeCellRenderer renderer = tree.getCellRenderer();

    if (renderer instanceof DefaultTreeCellRenderer) {
        DefaultTreeCellRenderer r = (DefaultTreeCellRenderer)renderer;
        SynthStyle style = context.getStyle();

        context.setComponentState(ENABLED | SELECTED);
        Color color = r.getTextSelectionColor();
        if (color == null || (color instanceof UIResource)) {
            r.setTextSelectionColor(style.getColor(
                                 context, ColorType.TEXT_FOREGROUND));
        }
        color = r.getBackgroundSelectionColor();
        if (color == null || (color instanceof UIResource)) {
            r.setBackgroundSelectionColor(style.getColor(
                                    context, ColorType.TEXT_BACKGROUND));
        }

        context.setComponentState(ENABLED);
        color = r.getTextNonSelectionColor();
        if (color == null || color instanceof UIResource) {
            r.setTextNonSelectionColor(style.getColorForState(
                                    context, ColorType.TEXT_FOREGROUND));
        }
        color = r.getBackgroundNonSelectionColor();
        if (color == null || color instanceof UIResource) {
            r.setBackgroundNonSelectionColor(style.getColorForState(
                              context, ColorType.TEXT_BACKGROUND));
        }
    }
}
 
Example 12
Source File: SynthTreeUI.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private void configureRenderer(SynthContext context) {
    TreeCellRenderer renderer = tree.getCellRenderer();

    if (renderer instanceof DefaultTreeCellRenderer) {
        DefaultTreeCellRenderer r = (DefaultTreeCellRenderer)renderer;
        SynthStyle style = context.getStyle();

        context.setComponentState(ENABLED | SELECTED);
        Color color = r.getTextSelectionColor();
        if (color == null || (color instanceof UIResource)) {
            r.setTextSelectionColor(style.getColor(
                                 context, ColorType.TEXT_FOREGROUND));
        }
        color = r.getBackgroundSelectionColor();
        if (color == null || (color instanceof UIResource)) {
            r.setBackgroundSelectionColor(style.getColor(
                                    context, ColorType.TEXT_BACKGROUND));
        }

        context.setComponentState(ENABLED);
        color = r.getTextNonSelectionColor();
        if (color == null || color instanceof UIResource) {
            r.setTextNonSelectionColor(style.getColorForState(
                                    context, ColorType.TEXT_FOREGROUND));
        }
        color = r.getBackgroundNonSelectionColor();
        if (color == null || color instanceof UIResource) {
            r.setBackgroundNonSelectionColor(style.getColorForState(
                              context, ColorType.TEXT_BACKGROUND));
        }
    }
}
 
Example 13
Source File: SynthTreeUI.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void configureRenderer(SynthContext context) {
    TreeCellRenderer renderer = tree.getCellRenderer();

    if (renderer instanceof DefaultTreeCellRenderer) {
        DefaultTreeCellRenderer r = (DefaultTreeCellRenderer)renderer;
        SynthStyle style = context.getStyle();

        context.setComponentState(ENABLED | SELECTED);
        Color color = r.getTextSelectionColor();
        if (color == null || (color instanceof UIResource)) {
            r.setTextSelectionColor(style.getColor(
                                 context, ColorType.TEXT_FOREGROUND));
        }
        color = r.getBackgroundSelectionColor();
        if (color == null || (color instanceof UIResource)) {
            r.setBackgroundSelectionColor(style.getColor(
                                    context, ColorType.TEXT_BACKGROUND));
        }

        context.setComponentState(ENABLED);
        color = r.getTextNonSelectionColor();
        if (color == null || color instanceof UIResource) {
            r.setTextNonSelectionColor(style.getColorForState(
                                    context, ColorType.TEXT_FOREGROUND));
        }
        color = r.getBackgroundNonSelectionColor();
        if (color == null || color instanceof UIResource) {
            r.setBackgroundNonSelectionColor(style.getColorForState(
                              context, ColorType.TEXT_BACKGROUND));
        }
    }
}
 
Example 14
Source File: SynthTreeUI.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
private void configureRenderer(SynthContext context) {
    TreeCellRenderer renderer = tree.getCellRenderer();

    if (renderer instanceof DefaultTreeCellRenderer) {
        DefaultTreeCellRenderer r = (DefaultTreeCellRenderer)renderer;
        SynthStyle style = context.getStyle();

        context.setComponentState(ENABLED | SELECTED);
        Color color = r.getTextSelectionColor();
        if (color == null || (color instanceof UIResource)) {
            r.setTextSelectionColor(style.getColor(
                                 context, ColorType.TEXT_FOREGROUND));
        }
        color = r.getBackgroundSelectionColor();
        if (color == null || (color instanceof UIResource)) {
            r.setBackgroundSelectionColor(style.getColor(
                                    context, ColorType.TEXT_BACKGROUND));
        }

        context.setComponentState(ENABLED);
        color = r.getTextNonSelectionColor();
        if (color == null || color instanceof UIResource) {
            r.setTextNonSelectionColor(style.getColorForState(
                                    context, ColorType.TEXT_FOREGROUND));
        }
        color = r.getBackgroundNonSelectionColor();
        if (color == null || color instanceof UIResource) {
            r.setBackgroundNonSelectionColor(style.getColorForState(
                              context, ColorType.TEXT_BACKGROUND));
        }
    }
}
 
Example 15
Source File: SynthTreeUI.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private void configureRenderer(SynthContext context) {
    TreeCellRenderer renderer = tree.getCellRenderer();

    if (renderer instanceof DefaultTreeCellRenderer) {
        DefaultTreeCellRenderer r = (DefaultTreeCellRenderer)renderer;
        SynthStyle style = context.getStyle();

        context.setComponentState(ENABLED | SELECTED);
        Color color = r.getTextSelectionColor();
        if (color == null || (color instanceof UIResource)) {
            r.setTextSelectionColor(style.getColor(
                                 context, ColorType.TEXT_FOREGROUND));
        }
        color = r.getBackgroundSelectionColor();
        if (color == null || (color instanceof UIResource)) {
            r.setBackgroundSelectionColor(style.getColor(
                                    context, ColorType.TEXT_BACKGROUND));
        }

        context.setComponentState(ENABLED);
        color = r.getTextNonSelectionColor();
        if (color == null || color instanceof UIResource) {
            r.setTextNonSelectionColor(style.getColorForState(
                                    context, ColorType.TEXT_FOREGROUND));
        }
        color = r.getBackgroundNonSelectionColor();
        if (color == null || color instanceof UIResource) {
            r.setBackgroundNonSelectionColor(style.getColorForState(
                              context, ColorType.TEXT_BACKGROUND));
        }
    }
}
 
Example 16
Source File: SynthTreeUI.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private void configureRenderer(SynthContext context) {
    TreeCellRenderer renderer = tree.getCellRenderer();

    if (renderer instanceof DefaultTreeCellRenderer) {
        DefaultTreeCellRenderer r = (DefaultTreeCellRenderer)renderer;
        SynthStyle style = context.getStyle();

        context.setComponentState(ENABLED | SELECTED);
        Color color = r.getTextSelectionColor();
        if (color == null || (color instanceof UIResource)) {
            r.setTextSelectionColor(style.getColor(
                                 context, ColorType.TEXT_FOREGROUND));
        }
        color = r.getBackgroundSelectionColor();
        if (color == null || (color instanceof UIResource)) {
            r.setBackgroundSelectionColor(style.getColor(
                                    context, ColorType.TEXT_BACKGROUND));
        }

        context.setComponentState(ENABLED);
        color = r.getTextNonSelectionColor();
        if (color == null || color instanceof UIResource) {
            r.setTextNonSelectionColor(style.getColorForState(
                                    context, ColorType.TEXT_FOREGROUND));
        }
        color = r.getBackgroundNonSelectionColor();
        if (color == null || color instanceof UIResource) {
            r.setBackgroundNonSelectionColor(style.getColorForState(
                              context, ColorType.TEXT_BACKGROUND));
        }
    }
}
 
Example 17
Source File: SynthTreeUI.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private void configureRenderer(SynthContext context) {
    TreeCellRenderer renderer = tree.getCellRenderer();

    if (renderer instanceof DefaultTreeCellRenderer) {
        DefaultTreeCellRenderer r = (DefaultTreeCellRenderer)renderer;
        SynthStyle style = context.getStyle();

        context.setComponentState(ENABLED | SELECTED);
        Color color = r.getTextSelectionColor();
        if (color == null || (color instanceof UIResource)) {
            r.setTextSelectionColor(style.getColor(
                                 context, ColorType.TEXT_FOREGROUND));
        }
        color = r.getBackgroundSelectionColor();
        if (color == null || (color instanceof UIResource)) {
            r.setBackgroundSelectionColor(style.getColor(
                                    context, ColorType.TEXT_BACKGROUND));
        }

        context.setComponentState(ENABLED);
        color = r.getTextNonSelectionColor();
        if (color == null || color instanceof UIResource) {
            r.setTextNonSelectionColor(style.getColorForState(
                                    context, ColorType.TEXT_FOREGROUND));
        }
        color = r.getBackgroundNonSelectionColor();
        if (color == null || color instanceof UIResource) {
            r.setBackgroundNonSelectionColor(style.getColorForState(
                              context, ColorType.TEXT_BACKGROUND));
        }
    }
}
 
Example 18
Source File: TreeTableTree.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void updateUI() {
  super.updateUI();
  TreeCellRenderer tcr = super.getCellRenderer();
  if (tcr instanceof DefaultTreeCellRenderer) {
    DefaultTreeCellRenderer dtcr = (DefaultTreeCellRenderer)tcr;
    dtcr.setTextSelectionColor(UIUtil.getTableSelectionForeground());
    dtcr.setBackgroundSelectionColor(UIUtil.getTableSelectionBackground());
  }
}
 
Example 19
Source File: SynthTreeUI.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private void configureRenderer(SynthContext context) {
    TreeCellRenderer renderer = tree.getCellRenderer();

    if (renderer instanceof DefaultTreeCellRenderer) {
        DefaultTreeCellRenderer r = (DefaultTreeCellRenderer)renderer;
        SynthStyle style = context.getStyle();

        context.setComponentState(ENABLED | SELECTED);
        Color color = r.getTextSelectionColor();
        if (color == null || (color instanceof UIResource)) {
            r.setTextSelectionColor(style.getColor(
                                 context, ColorType.TEXT_FOREGROUND));
        }
        color = r.getBackgroundSelectionColor();
        if (color == null || (color instanceof UIResource)) {
            r.setBackgroundSelectionColor(style.getColor(
                                    context, ColorType.TEXT_BACKGROUND));
        }

        context.setComponentState(ENABLED);
        color = r.getTextNonSelectionColor();
        if (color == null || color instanceof UIResource) {
            r.setTextNonSelectionColor(style.getColorForState(
                                    context, ColorType.TEXT_FOREGROUND));
        }
        color = r.getBackgroundNonSelectionColor();
        if (color == null || color instanceof UIResource) {
            r.setBackgroundNonSelectionColor(style.getColorForState(
                              context, ColorType.TEXT_BACKGROUND));
        }
    }
}
 
Example 20
Source File: DecoratedDemo.java    From pumpernickel with MIT License 4 votes vote down vote up
public TreeDemo() {
	getDecoratedComponent().putClientProperty(
			DecoratedTreeUI.KEY_DECORATIONS,
			new TreeDecoration[] { progressDecoration, starDecoration1,
					starDecoration2, starDecoration3, starDecoration4,
					starDecoration5, closeDecoration,
					playPauseDecoration, warningDecoration,
					refreshDecoration });

	// give the aqua progress indicator just a little bit more
	// vertical
	// space, and do it before setting UI for efficiency
	getDecoratedComponent().setRowHeight(24);
	getDecoratedComponent().setUI(new DecoratedTreeUI());
	DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer();
	renderer.setBackgroundSelectionColor(SystemColor.textHighlight);
	renderer.setTextSelectionColor(SystemColor.textHighlightText);

	/**
	 * We want to call setCellRenderer(..) *after* setUI(..) in this
	 * demo app just to verify that they can work in this order...
	 */
	getDecoratedComponent().setCellRenderer(renderer);
	getDecoratedComponent().setPreferredSize(new Dimension(200, 150));

	setLayout(new GridBagLayout());
	GridBagConstraints c = new GridBagConstraints();
	c.gridx = 0;
	c.gridy = 0;
	c.weightx = 1;
	c.weighty = 1;
	c.fill = GridBagConstraints.BOTH;
	add(getDecoratedComponent(), c);
	c.weighty = 0;
	c.gridy++;
	add(stretchHighlight, c);

	stretchHighlight.addActionListener(new ActionListener() {
		public void actionPerformed(ActionEvent e) {
			getDecoratedComponent().setUI(
					new DecoratedTreeUI(stretchHighlight.isSelected()));
		}
	});
	stretchHighlight.setBackground(getDecoratedComponent()
			.getBackground());
	stretchHighlight.setOpaque(true);
}