/**
  * Gets the background color for active {@link javax.swing.JInternalFrame}'s.
  *
  * @return the background color for active {@link javax.swing.JInternalFrame}'s
  */
 public ColorUIResource getActiveInternalFrameTitleBackgroundColor() {
   return activeInternalFrameTitleBackgroundColor.getColor();
 }
 /**
  * Gets the foreground color for inactive {@link javax.swing.JInternalFrame}'s.
  *
  * @return the foreground color for inactive {@link javax.swing.JInternalFrame}'s
  */
 public ColorUIResource getInactiveInternalFrameTitleForegroundColor() {
   return inactiveInternalFrameTitleForegroundColor.getColor();
 }
 /**
  * Gets the color used for inactive text.
  *
  * @return the color used for inactive text
  */
 public ColorUIResource getInactiveTextColor() {
   return inactiveTextColor.getColor();
 }
 /**
  * Gets the background color for {@link javax.swing.JScrollBar}'s.
  *
  * @return the background color for {@link javax.swing.JScrollBar}'s
  */
 public ColorUIResource getScrollBarBackgroundColor() {
   return scrollBarBackgroundColor.getColor();
 }
 /**
  * Gets the background color used for {@link javax.swing.JComponent}.
  *
  * @return the background color used for {@link javax.swing.JComponent}
  */
 public ColorUIResource getControlColor() {
   return controlColor.getColor();
 }
 /**
  * Gets the foreground color used for selected {@link javax.swing.JMenuItem}'s.
  *
  * @return the foreground color used for selected {@link javax.swing.JMenuItem}'s
  */
 public ColorUIResource getSelectedMenuForegroundColor() {
   return selectedMenuForegroundColor.getColor();
 }
 /**
  * Gets the background color for {@link javax.swing.JToolTip}.
  *
  * @return the background color for {@link javax.swing.JToolTip}
  */
 public ColorUIResource getTooltipBackgroundColor() {
   return tooltipBackgroundColor.getColor();
 }
 /**
  * Sets the background color used in {@link javax.swing.JViewport}, {@link javax.swing.JTree},
  * {@link javax.swing.JTable} etc.
  *
  * @param c the background color used in {@link javax.swing.JViewport}, {@link javax.swing.JTree},
  *     {@link javax.swing.JTable} etc.
  */
 public void setBackgroundColor(Color c) {
   backgroundColor.setColor(c);
   updateColors();
 }
 /**
  * Gets the control focus marker color.
  *
  * @return the control focus marker color
  */
 public ColorUIResource getFocusColor() {
   return focusColor.getColor();
 }
 /**
  * Gets the selected text color.
  *
  * @return the selected text color
  */
 public ColorUIResource getSelectedTextColor() {
   return selectedTextColor.getColor();
 }
 /**
  * Gets the text color.
  *
  * @return the text color
  */
 public ColorUIResource getTextColor() {
   return textColor.getColor();
 }
 /**
  * Gets the background color for {@link javax.swing.JViewport}, {@link javax.swing.JTree}, {@link
  * javax.swing.JTable} etc.
  *
  * @return the background color for {@link javax.swing.JViewport}, {@link javax.swing.JTree},
  *     {@link javax.swing.JTable} etc.
  */
 public ColorUIResource getBackgroundColor() {
   return backgroundColor.getColor();
 }
 /**
  * Gets the color of scrollbar "knobs" etc.
  *
  * @return the color of scrollbar "knobs" etc,
  */
 public ColorUIResource getPrimaryControlColor() {
   return primaryControlColor.getColor();
 }
 /**
  * Gets the gradient color for inactive {@link javax.swing.JInternalFrame}'s.
  *
  * @return the gradient color for inactive {@link javax.swing.JInternalFrame}'s
  */
 public ColorUIResource getInactiveInternalFrameTitleGradientColor() {
   return inactiveInternalFrameTitleGradientColor.getColor();
 }
 /**
  * Gets the desktop color used in {@link javax.swing.JDesktopPane} etc.
  *
  * @return the desktop color used in {@link javax.swing.JDesktopPane} etc.
  */
 public ColorUIResource getDesktopColor() {
   return desktopColor.getColor();
 }
 /**
  * Sets the primary control background color used in scroll bar knobs etc.
  *
  * @param c the primary control background color
  */
 public void setPrimaryControlColor(Color c) {
   primaryControlColor.setColor(c);
   updateColors();
 }
 /**
  * Gets the background color used for collapse and expand icons in a {@link javax.swing.JTree}.
  *
  * @return the background color used for collapse and expand icons in a {@link javax.swing.JTree}
  */
 public ColorUIResource getTreeIconBackgroundColor() {
   return treeIconBackgroundColor.getColor();
 }
 /**
  * Sets the text color.
  *
  * @param c the text color
  */
 public void setTextColor(Color c) {
   textColor.setColor(c);
   updateColors();
 }
  private void updateColors() {
    focusColor.setDefaultColor(
        ColorUtil.blend(controlColor.getColor(), textColor.getColor(), 0.5f));

    inactiveTextColor.setDefaultColor(focusColor);

    double invShadeAmount = 1.0 / (1 + shadingFactor * 1.2);
    double invShadeAmount2 = 1.0 / (1 + shadingFactor / 2);
    double invShadeAmount3 = 1.0 / (1 + shadingFactor / 7);

    controlHighlightColor =
        new ColorUIResource(ColorUtil.mult(controlColor.getColor(), 1 + shadingFactor));
    controlLightShadowColor =
        new ColorUIResource(ColorUtil.mult(controlColor.getColor(), invShadeAmount3));
    controlShadowColor =
        new ColorUIResource(ColorUtil.mult(controlColor.getColor(), invShadeAmount2));
    controlDarkShadowColor =
        new ColorUIResource(ColorUtil.mult(controlColor.getColor(), invShadeAmount));

    primaryControlHighlightColor = controlHighlightColor;
    primaryControlShadowColor =
        new ColorUIResource(ColorUtil.mult(primaryControlColor.getColor(), invShadeAmount2));
    primaryControlDarkShadowColor =
        new ColorUIResource(ColorUtil.mult(primaryControlColor.getColor(), invShadeAmount));

    scrollBarBackgroundColor.setDefaultColor(controlLightShadowColor);
    scrollBarBackgroundShadowColor =
        new ColorUIResource(ColorUtil.mult(scrollBarBackgroundColor.getColor(), invShadeAmount));

    selectedMenuBackgroundColor.setDefaultColor(selectedTextBackgroundColor);
    selectedMenuForegroundColor.setDefaultColor(selectedTextColor);

    treeIconBackgroundColor.setDefaultColor(
        ColorUtil.blend(backgroundColor.getColor(), primaryControlColor.getColor(), 0.15f));

    activeInternalFrameTitleBackgroundColor.setDefaultColor(
        ColorUtil.blend(
            primaryControlColor.getColor(), ColorUtil.getOpposite(getTextColor()), 0.5f));
    activeInternalFrameTitleForegroundColor.setDefaultColor(getTextColor());
    activeInternalFrameTitleGradientColor.setDefaultColor(
        ColorUtil.mult(activeInternalFrameTitleBackgroundColor.getColor(), 1.2));
    inactiveInternalFrameTitleBackgroundColor.setDefaultColor(controlLightShadowColor);
    inactiveInternalFrameTitleForegroundColor.setDefaultColor(getTextColor());
    inactiveInternalFrameTitleGradientColor.setDefaultColor(
        ColorUtil.mult(inactiveInternalFrameTitleBackgroundColor.getColor(), 1.2));

    menuBarBorder.setDefaultBorder(
        new BorderUIResource(
            new EtchedLineBorder(
                false, false, true, false, controlHighlightColor, controlDarkShadowColor)));
    popupMenuBorder.setDefaultBorder(
        new BorderUIResource(new PopupMenuBorder(controlHighlightColor, controlDarkShadowColor)));
    textFieldBorder.setDefaultBorder(
        new BorderUIResource(
            new CompoundBorder(
                new LineBorder(controlDarkShadowColor), new EmptyBorder(1, 2, 1, 2))));

    tableHeaderCellBorder.setDefaultBorder(
        new BorderUIResource(
            new CompoundBorder(
                new CompoundBorder(
                    new EdgeBorder(controlDarkShadowColor, false, true, false, true),
                    new HighlightBorder(false, controlHighlightColor)),
                new EmptyBorder(1, 4, 1, 4))));

    listFocusedItemBorder.setDefaultBorder(
        new CompoundBorder(new LineBorder(focusColor.getColor()), new EmptyBorder(0, 3, 0, 3)));
  }