Java Code Examples for javax.swing.plaf.synth.ColorType#TEXT_BACKGROUND

The following examples show how to use javax.swing.plaf.synth.ColorType#TEXT_BACKGROUND . 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: NimbusStyle.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * <p>Overridden to cause this style to populate itself with data from
 * UIDefaults, if necessary.</p>
 *
 * <p>In addition, NimbusStyle handles ColorTypes slightly differently from
 * Synth.</p>
 * <ul>
 *  <li>ColorType.BACKGROUND will equate to the color stored in UIDefaults
 *      named "background".</li>
 *  <li>ColorType.TEXT_BACKGROUND will equate to the color stored in
 *      UIDefaults named "textBackground".</li>
 *  <li>ColorType.FOREGROUND will equate to the color stored in UIDefaults
 *      named "textForeground".</li>
 *  <li>ColorType.TEXT_FOREGROUND will equate to the color stored in
 *      UIDefaults named "textForeground".</li>
 * </ul>
 */
@Override protected Color getColorForState(SynthContext ctx, ColorType type) {
    String key = null;
    if (type == ColorType.BACKGROUND) {
        key = "background";
    } else if (type == ColorType.FOREGROUND) {
        //map FOREGROUND as TEXT_FOREGROUND
        key = "textForeground";
    } else if (type == ColorType.TEXT_BACKGROUND) {
        key = "textBackground";
    } else if (type == ColorType.TEXT_FOREGROUND) {
        key = "textForeground";
    } else if (type == ColorType.FOCUS) {
        key = "focus";
    } else if (type != null) {
        key = type.toString();
    } else {
        return DEFAULT_COLOR;
    }
    Color c = (Color) get(ctx, key);
    //if all else fails, return a default color (which is a ColorUIResource)
    if (c == null) c = DEFAULT_COLOR;
    return c;
}
 
Example 2
Source File: NimbusStyle.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * <p>Overridden to cause this style to populate itself with data from
 * UIDefaults, if necessary.</p>
 *
 * <p>In addition, NimbusStyle handles ColorTypes slightly differently from
 * Synth.</p>
 * <ul>
 *  <li>ColorType.BACKGROUND will equate to the color stored in UIDefaults
 *      named "background".</li>
 *  <li>ColorType.TEXT_BACKGROUND will equate to the color stored in
 *      UIDefaults named "textBackground".</li>
 *  <li>ColorType.FOREGROUND will equate to the color stored in UIDefaults
 *      named "textForeground".</li>
 *  <li>ColorType.TEXT_FOREGROUND will equate to the color stored in
 *      UIDefaults named "textForeground".</li>
 * </ul>
 */
@Override protected Color getColorForState(SynthContext ctx, ColorType type) {
    String key = null;
    if (type == ColorType.BACKGROUND) {
        key = "background";
    } else if (type == ColorType.FOREGROUND) {
        //map FOREGROUND as TEXT_FOREGROUND
        key = "textForeground";
    } else if (type == ColorType.TEXT_BACKGROUND) {
        key = "textBackground";
    } else if (type == ColorType.TEXT_FOREGROUND) {
        key = "textForeground";
    } else if (type == ColorType.FOCUS) {
        key = "focus";
    } else if (type != null) {
        key = type.toString();
    } else {
        return DEFAULT_COLOR;
    }
    Color c = (Color) get(ctx, key);
    //if all else fails, return a default color (which is a ColorUIResource)
    if (c == null) c = DEFAULT_COLOR;
    return c;
}
 
Example 3
Source File: NimbusStyle.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * <p>Overridden to cause this style to populate itself with data from
 * UIDefaults, if necessary.</p>
 *
 * <p>In addition, NimbusStyle handles ColorTypes slightly differently from
 * Synth.</p>
 * <ul>
 *  <li>ColorType.BACKGROUND will equate to the color stored in UIDefaults
 *      named "background".</li>
 *  <li>ColorType.TEXT_BACKGROUND will equate to the color stored in
 *      UIDefaults named "textBackground".</li>
 *  <li>ColorType.FOREGROUND will equate to the color stored in UIDefaults
 *      named "textForeground".</li>
 *  <li>ColorType.TEXT_FOREGROUND will equate to the color stored in
 *      UIDefaults named "textForeground".</li>
 * </ul>
 */
@Override protected Color getColorForState(SynthContext ctx, ColorType type) {
    String key = null;
    if (type == ColorType.BACKGROUND) {
        key = "background";
    } else if (type == ColorType.FOREGROUND) {
        //map FOREGROUND as TEXT_FOREGROUND
        key = "textForeground";
    } else if (type == ColorType.TEXT_BACKGROUND) {
        key = "textBackground";
    } else if (type == ColorType.TEXT_FOREGROUND) {
        key = "textForeground";
    } else if (type == ColorType.FOCUS) {
        key = "focus";
    } else if (type != null) {
        key = type.toString();
    } else {
        return DEFAULT_COLOR;
    }
    Color c = (Color) get(ctx, key);
    //if all else fails, return a default color (which is a ColorUIResource)
    if (c == null) c = DEFAULT_COLOR;
    return c;
}
 
Example 4
Source File: NimbusStyle.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * <p>Overridden to cause this style to populate itself with data from
 * UIDefaults, if necessary.</p>
 *
 * <p>In addition, NimbusStyle handles ColorTypes slightly differently from
 * Synth.</p>
 * <ul>
 *  <li>ColorType.BACKGROUND will equate to the color stored in UIDefaults
 *      named "background".</li>
 *  <li>ColorType.TEXT_BACKGROUND will equate to the color stored in
 *      UIDefaults named "textBackground".</li>
 *  <li>ColorType.FOREGROUND will equate to the color stored in UIDefaults
 *      named "textForeground".</li>
 *  <li>ColorType.TEXT_FOREGROUND will equate to the color stored in
 *      UIDefaults named "textForeground".</li>
 * </ul>
 */
@Override protected Color getColorForState(SynthContext ctx, ColorType type) {
    String key = null;
    if (type == ColorType.BACKGROUND) {
        key = "background";
    } else if (type == ColorType.FOREGROUND) {
        //map FOREGROUND as TEXT_FOREGROUND
        key = "textForeground";
    } else if (type == ColorType.TEXT_BACKGROUND) {
        key = "textBackground";
    } else if (type == ColorType.TEXT_FOREGROUND) {
        key = "textForeground";
    } else if (type == ColorType.FOCUS) {
        key = "focus";
    } else if (type != null) {
        key = type.toString();
    } else {
        return DEFAULT_COLOR;
    }
    Color c = (Color) get(ctx, key);
    //if all else fails, return a default color (which is a ColorUIResource)
    if (c == null) c = DEFAULT_COLOR;
    return c;
}
 
Example 5
Source File: NimbusStyle.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * <p>Overridden to cause this style to populate itself with data from
 * UIDefaults, if necessary.</p>
 *
 * <p>In addition, NimbusStyle handles ColorTypes slightly differently from
 * Synth.</p>
 * <ul>
 *  <li>ColorType.BACKGROUND will equate to the color stored in UIDefaults
 *      named "background".</li>
 *  <li>ColorType.TEXT_BACKGROUND will equate to the color stored in
 *      UIDefaults named "textBackground".</li>
 *  <li>ColorType.FOREGROUND will equate to the color stored in UIDefaults
 *      named "textForeground".</li>
 *  <li>ColorType.TEXT_FOREGROUND will equate to the color stored in
 *      UIDefaults named "textForeground".</li>
 * </ul>
 */
@Override protected Color getColorForState(SynthContext ctx, ColorType type) {
    String key = null;
    if (type == ColorType.BACKGROUND) {
        key = "background";
    } else if (type == ColorType.FOREGROUND) {
        //map FOREGROUND as TEXT_FOREGROUND
        key = "textForeground";
    } else if (type == ColorType.TEXT_BACKGROUND) {
        key = "textBackground";
    } else if (type == ColorType.TEXT_FOREGROUND) {
        key = "textForeground";
    } else if (type == ColorType.FOCUS) {
        key = "focus";
    } else if (type != null) {
        key = type.toString();
    } else {
        return DEFAULT_COLOR;
    }
    Color c = (Color) get(ctx, key);
    //if all else fails, return a default color (which is a ColorUIResource)
    if (c == null) c = DEFAULT_COLOR;
    return c;
}
 
Example 6
Source File: NimbusStyle.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * <p>Overridden to cause this style to populate itself with data from
 * UIDefaults, if necessary.</p>
 *
 * <p>In addition, NimbusStyle handles ColorTypes slightly differently from
 * Synth.</p>
 * <ul>
 *  <li>ColorType.BACKGROUND will equate to the color stored in UIDefaults
 *      named "background".</li>
 *  <li>ColorType.TEXT_BACKGROUND will equate to the color stored in
 *      UIDefaults named "textBackground".</li>
 *  <li>ColorType.FOREGROUND will equate to the color stored in UIDefaults
 *      named "textForeground".</li>
 *  <li>ColorType.TEXT_FOREGROUND will equate to the color stored in
 *      UIDefaults named "textForeground".</li>
 * </ul>
 */
@Override protected Color getColorForState(SynthContext ctx, ColorType type) {
    String key = null;
    if (type == ColorType.BACKGROUND) {
        key = "background";
    } else if (type == ColorType.FOREGROUND) {
        //map FOREGROUND as TEXT_FOREGROUND
        key = "textForeground";
    } else if (type == ColorType.TEXT_BACKGROUND) {
        key = "textBackground";
    } else if (type == ColorType.TEXT_FOREGROUND) {
        key = "textForeground";
    } else if (type == ColorType.FOCUS) {
        key = "focus";
    } else if (type != null) {
        key = type.toString();
    } else {
        return DEFAULT_COLOR;
    }
    Color c = (Color) get(ctx, key);
    //if all else fails, return a default color (which is a ColorUIResource)
    if (c == null) c = DEFAULT_COLOR;
    return c;
}
 
Example 7
Source File: NimbusStyle.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * <p>Overridden to cause this style to populate itself with data from
 * UIDefaults, if necessary.</p>
 *
 * <p>In addition, NimbusStyle handles ColorTypes slightly differently from
 * Synth.</p>
 * <ul>
 *  <li>ColorType.BACKGROUND will equate to the color stored in UIDefaults
 *      named "background".</li>
 *  <li>ColorType.TEXT_BACKGROUND will equate to the color stored in
 *      UIDefaults named "textBackground".</li>
 *  <li>ColorType.FOREGROUND will equate to the color stored in UIDefaults
 *      named "textForeground".</li>
 *  <li>ColorType.TEXT_FOREGROUND will equate to the color stored in
 *      UIDefaults named "textForeground".</li>
 * </ul>
 */
@Override protected Color getColorForState(SynthContext ctx, ColorType type) {
    String key = null;
    if (type == ColorType.BACKGROUND) {
        key = "background";
    } else if (type == ColorType.FOREGROUND) {
        //map FOREGROUND as TEXT_FOREGROUND
        key = "textForeground";
    } else if (type == ColorType.TEXT_BACKGROUND) {
        key = "textBackground";
    } else if (type == ColorType.TEXT_FOREGROUND) {
        key = "textForeground";
    } else if (type == ColorType.FOCUS) {
        key = "focus";
    } else if (type != null) {
        key = type.toString();
    } else {
        return DEFAULT_COLOR;
    }
    Color c = (Color) get(ctx, key);
    //if all else fails, return a default color (which is a ColorUIResource)
    if (c == null) c = DEFAULT_COLOR;
    return c;
}
 
Example 8
Source File: NimbusStyle.java    From Java8CN with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * <p>Overridden to cause this style to populate itself with data from
 * UIDefaults, if necessary.</p>
 *
 * <p>In addition, NimbusStyle handles ColorTypes slightly differently from
 * Synth.</p>
 * <ul>
 *  <li>ColorType.BACKGROUND will equate to the color stored in UIDefaults
 *      named "background".</li>
 *  <li>ColorType.TEXT_BACKGROUND will equate to the color stored in
 *      UIDefaults named "textBackground".</li>
 *  <li>ColorType.FOREGROUND will equate to the color stored in UIDefaults
 *      named "textForeground".</li>
 *  <li>ColorType.TEXT_FOREGROUND will equate to the color stored in
 *      UIDefaults named "textForeground".</li>
 * </ul>
 */
@Override protected Color getColorForState(SynthContext ctx, ColorType type) {
    String key = null;
    if (type == ColorType.BACKGROUND) {
        key = "background";
    } else if (type == ColorType.FOREGROUND) {
        //map FOREGROUND as TEXT_FOREGROUND
        key = "textForeground";
    } else if (type == ColorType.TEXT_BACKGROUND) {
        key = "textBackground";
    } else if (type == ColorType.TEXT_FOREGROUND) {
        key = "textForeground";
    } else if (type == ColorType.FOCUS) {
        key = "focus";
    } else if (type != null) {
        key = type.toString();
    } else {
        return DEFAULT_COLOR;
    }
    Color c = (Color) get(ctx, key);
    //if all else fails, return a default color (which is a ColorUIResource)
    if (c == null) c = DEFAULT_COLOR;
    return c;
}
 
Example 9
Source File: NimbusStyle.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * <p>Overridden to cause this style to populate itself with data from
 * UIDefaults, if necessary.</p>
 *
 * <p>In addition, NimbusStyle handles ColorTypes slightly differently from
 * Synth.</p>
 * <ul>
 *  <li>ColorType.BACKGROUND will equate to the color stored in UIDefaults
 *      named "background".</li>
 *  <li>ColorType.TEXT_BACKGROUND will equate to the color stored in
 *      UIDefaults named "textBackground".</li>
 *  <li>ColorType.FOREGROUND will equate to the color stored in UIDefaults
 *      named "textForeground".</li>
 *  <li>ColorType.TEXT_FOREGROUND will equate to the color stored in
 *      UIDefaults named "textForeground".</li>
 * </ul>
 */
@Override protected Color getColorForState(SynthContext ctx, ColorType type) {
    String key = null;
    if (type == ColorType.BACKGROUND) {
        key = "background";
    } else if (type == ColorType.FOREGROUND) {
        //map FOREGROUND as TEXT_FOREGROUND
        key = "textForeground";
    } else if (type == ColorType.TEXT_BACKGROUND) {
        key = "textBackground";
    } else if (type == ColorType.TEXT_FOREGROUND) {
        key = "textForeground";
    } else if (type == ColorType.FOCUS) {
        key = "focus";
    } else if (type != null) {
        key = type.toString();
    } else {
        return DEFAULT_COLOR;
    }
    Color c = (Color) get(ctx, key);
    //if all else fails, return a default color (which is a ColorUIResource)
    if (c == null) c = DEFAULT_COLOR;
    return c;
}
 
Example 10
Source File: NimbusStyle.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * <p>Overridden to cause this style to populate itself with data from
 * UIDefaults, if necessary.</p>
 *
 * <p>In addition, NimbusStyle handles ColorTypes slightly differently from
 * Synth.</p>
 * <ul>
 *  <li>ColorType.BACKGROUND will equate to the color stored in UIDefaults
 *      named "background".</li>
 *  <li>ColorType.TEXT_BACKGROUND will equate to the color stored in
 *      UIDefaults named "textBackground".</li>
 *  <li>ColorType.FOREGROUND will equate to the color stored in UIDefaults
 *      named "textForeground".</li>
 *  <li>ColorType.TEXT_FOREGROUND will equate to the color stored in
 *      UIDefaults named "textForeground".</li>
 * </ul>
 */
@Override protected Color getColorForState(SynthContext ctx, ColorType type) {
    String key = null;
    if (type == ColorType.BACKGROUND) {
        key = "background";
    } else if (type == ColorType.FOREGROUND) {
        //map FOREGROUND as TEXT_FOREGROUND
        key = "textForeground";
    } else if (type == ColorType.TEXT_BACKGROUND) {
        key = "textBackground";
    } else if (type == ColorType.TEXT_FOREGROUND) {
        key = "textForeground";
    } else if (type == ColorType.FOCUS) {
        key = "focus";
    } else if (type != null) {
        key = type.toString();
    } else {
        return DEFAULT_COLOR;
    }
    Color c = (Color) get(ctx, key);
    //if all else fails, return a default color (which is a ColorUIResource)
    if (c == null) c = DEFAULT_COLOR;
    return c;
}
 
Example 11
Source File: NimbusStyle.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * <p>Overridden to cause this style to populate itself with data from
 * UIDefaults, if necessary.</p>
 *
 * <p>In addition, NimbusStyle handles ColorTypes slightly differently from
 * Synth.</p>
 * <ul>
 *  <li>ColorType.BACKGROUND will equate to the color stored in UIDefaults
 *      named "background".</li>
 *  <li>ColorType.TEXT_BACKGROUND will equate to the color stored in
 *      UIDefaults named "textBackground".</li>
 *  <li>ColorType.FOREGROUND will equate to the color stored in UIDefaults
 *      named "textForeground".</li>
 *  <li>ColorType.TEXT_FOREGROUND will equate to the color stored in
 *      UIDefaults named "textForeground".</li>
 * </ul>
 */
@Override protected Color getColorForState(SynthContext ctx, ColorType type) {
    String key = null;
    if (type == ColorType.BACKGROUND) {
        key = "background";
    } else if (type == ColorType.FOREGROUND) {
        //map FOREGROUND as TEXT_FOREGROUND
        key = "textForeground";
    } else if (type == ColorType.TEXT_BACKGROUND) {
        key = "textBackground";
    } else if (type == ColorType.TEXT_FOREGROUND) {
        key = "textForeground";
    } else if (type == ColorType.FOCUS) {
        key = "focus";
    } else if (type != null) {
        key = type.toString();
    } else {
        return DEFAULT_COLOR;
    }
    Color c = (Color) get(ctx, key);
    //if all else fails, return a default color (which is a ColorUIResource)
    if (c == null) c = DEFAULT_COLOR;
    return c;
}
 
Example 12
Source File: NimbusStyle.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * <p>Overridden to cause this style to populate itself with data from
 * UIDefaults, if necessary.</p>
 *
 * <p>In addition, NimbusStyle handles ColorTypes slightly differently from
 * Synth.</p>
 * <ul>
 *  <li>ColorType.BACKGROUND will equate to the color stored in UIDefaults
 *      named "background".</li>
 *  <li>ColorType.TEXT_BACKGROUND will equate to the color stored in
 *      UIDefaults named "textBackground".</li>
 *  <li>ColorType.FOREGROUND will equate to the color stored in UIDefaults
 *      named "textForeground".</li>
 *  <li>ColorType.TEXT_FOREGROUND will equate to the color stored in
 *      UIDefaults named "textForeground".</li>
 * </ul>
 */
@Override protected Color getColorForState(SynthContext ctx, ColorType type) {
    String key = null;
    if (type == ColorType.BACKGROUND) {
        key = "background";
    } else if (type == ColorType.FOREGROUND) {
        //map FOREGROUND as TEXT_FOREGROUND
        key = "textForeground";
    } else if (type == ColorType.TEXT_BACKGROUND) {
        key = "textBackground";
    } else if (type == ColorType.TEXT_FOREGROUND) {
        key = "textForeground";
    } else if (type == ColorType.FOCUS) {
        key = "focus";
    } else if (type != null) {
        key = type.toString();
    } else {
        return DEFAULT_COLOR;
    }
    Color c = (Color) get(ctx, key);
    //if all else fails, return a default color (which is a ColorUIResource)
    if (c == null) c = DEFAULT_COLOR;
    return c;
}
 
Example 13
Source File: NimbusStyle.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * <p>Overridden to cause this style to populate itself with data from
 * UIDefaults, if necessary.</p>
 *
 * <p>In addition, NimbusStyle handles ColorTypes slightly differently from
 * Synth.</p>
 * <ul>
 *  <li>ColorType.BACKGROUND will equate to the color stored in UIDefaults
 *      named "background".</li>
 *  <li>ColorType.TEXT_BACKGROUND will equate to the color stored in
 *      UIDefaults named "textBackground".</li>
 *  <li>ColorType.FOREGROUND will equate to the color stored in UIDefaults
 *      named "textForeground".</li>
 *  <li>ColorType.TEXT_FOREGROUND will equate to the color stored in
 *      UIDefaults named "textForeground".</li>
 * </ul>
 */
@Override protected Color getColorForState(SynthContext ctx, ColorType type) {
    String key = null;
    if (type == ColorType.BACKGROUND) {
        key = "background";
    } else if (type == ColorType.FOREGROUND) {
        //map FOREGROUND as TEXT_FOREGROUND
        key = "textForeground";
    } else if (type == ColorType.TEXT_BACKGROUND) {
        key = "textBackground";
    } else if (type == ColorType.TEXT_FOREGROUND) {
        key = "textForeground";
    } else if (type == ColorType.FOCUS) {
        key = "focus";
    } else if (type != null) {
        key = type.toString();
    } else {
        return DEFAULT_COLOR;
    }
    Color c = (Color) get(ctx, key);
    //if all else fails, return a default color (which is a ColorUIResource)
    if (c == null) c = DEFAULT_COLOR;
    return c;
}
 
Example 14
Source File: NimbusStyle.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * <p>Overridden to cause this style to populate itself with data from
 * UIDefaults, if necessary.</p>
 *
 * <p>In addition, NimbusStyle handles ColorTypes slightly differently from
 * Synth.</p>
 * <ul>
 *  <li>ColorType.BACKGROUND will equate to the color stored in UIDefaults
 *      named "background".</li>
 *  <li>ColorType.TEXT_BACKGROUND will equate to the color stored in
 *      UIDefaults named "textBackground".</li>
 *  <li>ColorType.FOREGROUND will equate to the color stored in UIDefaults
 *      named "textForeground".</li>
 *  <li>ColorType.TEXT_FOREGROUND will equate to the color stored in
 *      UIDefaults named "textForeground".</li>
 * </ul>
 */
@Override protected Color getColorForState(SynthContext ctx, ColorType type) {
    String key = null;
    if (type == ColorType.BACKGROUND) {
        key = "background";
    } else if (type == ColorType.FOREGROUND) {
        //map FOREGROUND as TEXT_FOREGROUND
        key = "textForeground";
    } else if (type == ColorType.TEXT_BACKGROUND) {
        key = "textBackground";
    } else if (type == ColorType.TEXT_FOREGROUND) {
        key = "textForeground";
    } else if (type == ColorType.FOCUS) {
        key = "focus";
    } else if (type != null) {
        key = type.toString();
    } else {
        return DEFAULT_COLOR;
    }
    Color c = (Color) get(ctx, key);
    //if all else fails, return a default color (which is a ColorUIResource)
    if (c == null) c = DEFAULT_COLOR;
    return c;
}
 
Example 15
Source File: NimbusStyle.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * <p>Overridden to cause this style to populate itself with data from
 * UIDefaults, if necessary.</p>
 *
 * <p>In addition, NimbusStyle handles ColorTypes slightly differently from
 * Synth.</p>
 * <ul>
 *  <li>ColorType.BACKGROUND will equate to the color stored in UIDefaults
 *      named "background".</li>
 *  <li>ColorType.TEXT_BACKGROUND will equate to the color stored in
 *      UIDefaults named "textBackground".</li>
 *  <li>ColorType.FOREGROUND will equate to the color stored in UIDefaults
 *      named "textForeground".</li>
 *  <li>ColorType.TEXT_FOREGROUND will equate to the color stored in
 *      UIDefaults named "textForeground".</li>
 * </ul>
 */
@Override protected Color getColorForState(SynthContext ctx, ColorType type) {
    String key = null;
    if (type == ColorType.BACKGROUND) {
        key = "background";
    } else if (type == ColorType.FOREGROUND) {
        //map FOREGROUND as TEXT_FOREGROUND
        key = "textForeground";
    } else if (type == ColorType.TEXT_BACKGROUND) {
        key = "textBackground";
    } else if (type == ColorType.TEXT_FOREGROUND) {
        key = "textForeground";
    } else if (type == ColorType.FOCUS) {
        key = "focus";
    } else if (type != null) {
        key = type.toString();
    } else {
        return DEFAULT_COLOR;
    }
    Color c = (Color) get(ctx, key);
    //if all else fails, return a default color (which is a ColorUIResource)
    if (c == null) c = DEFAULT_COLOR;
    return c;
}
 
Example 16
Source File: NimbusStyle.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * <p>Overridden to cause this style to populate itself with data from
 * UIDefaults, if necessary.</p>
 *
 * <p>In addition, NimbusStyle handles ColorTypes slightly differently from
 * Synth.</p>
 * <ul>
 *  <li>ColorType.BACKGROUND will equate to the color stored in UIDefaults
 *      named "background".</li>
 *  <li>ColorType.TEXT_BACKGROUND will equate to the color stored in
 *      UIDefaults named "textBackground".</li>
 *  <li>ColorType.FOREGROUND will equate to the color stored in UIDefaults
 *      named "textForeground".</li>
 *  <li>ColorType.TEXT_FOREGROUND will equate to the color stored in
 *      UIDefaults named "textForeground".</li>
 * </ul>
 */
@Override protected Color getColorForState(SynthContext ctx, ColorType type) {
    String key = null;
    if (type == ColorType.BACKGROUND) {
        key = "background";
    } else if (type == ColorType.FOREGROUND) {
        //map FOREGROUND as TEXT_FOREGROUND
        key = "textForeground";
    } else if (type == ColorType.TEXT_BACKGROUND) {
        key = "textBackground";
    } else if (type == ColorType.TEXT_FOREGROUND) {
        key = "textForeground";
    } else if (type == ColorType.FOCUS) {
        key = "focus";
    } else if (type != null) {
        key = type.toString();
    } else {
        return DEFAULT_COLOR;
    }
    Color c = (Color) get(ctx, key);
    //if all else fails, return a default color (which is a ColorUIResource)
    if (c == null) c = DEFAULT_COLOR;
    return c;
}
 
Example 17
Source File: NimbusStyle.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * <p>Overridden to cause this style to populate itself with data from
 * UIDefaults, if necessary.</p>
 *
 * <p>In addition, NimbusStyle handles ColorTypes slightly differently from
 * Synth.</p>
 * <ul>
 *  <li>ColorType.BACKGROUND will equate to the color stored in UIDefaults
 *      named "background".</li>
 *  <li>ColorType.TEXT_BACKGROUND will equate to the color stored in
 *      UIDefaults named "textBackground".</li>
 *  <li>ColorType.FOREGROUND will equate to the color stored in UIDefaults
 *      named "textForeground".</li>
 *  <li>ColorType.TEXT_FOREGROUND will equate to the color stored in
 *      UIDefaults named "textForeground".</li>
 * </ul>
 */
@Override protected Color getColorForState(SynthContext ctx, ColorType type) {
    String key = null;
    if (type == ColorType.BACKGROUND) {
        key = "background";
    } else if (type == ColorType.FOREGROUND) {
        //map FOREGROUND as TEXT_FOREGROUND
        key = "textForeground";
    } else if (type == ColorType.TEXT_BACKGROUND) {
        key = "textBackground";
    } else if (type == ColorType.TEXT_FOREGROUND) {
        key = "textForeground";
    } else if (type == ColorType.FOCUS) {
        key = "focus";
    } else if (type != null) {
        key = type.toString();
    } else {
        return DEFAULT_COLOR;
    }
    Color c = (Color) get(ctx, key);
    //if all else fails, return a default color (which is a ColorUIResource)
    if (c == null) c = DEFAULT_COLOR;
    return c;
}
 
Example 18
Source File: SeaGlassStyle.java    From seaglass with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the color for the specified state. This should NOT call any
 * methods on the <code>JComponent</code>.
 *
 * <p>Overridden to cause this style to populate itself with data from
 * UIDefaults, if necessary.</p>
 *
 * <p>In addition, SeaGlassStyle handles ColorTypes slightly differently
 * from Synth.</p>
 *
 * <ul>
 *   <li>ColorType.BACKGROUND will equate to the color stored in UIDefaults
 *     named "background".</li>
 *   <li>ColorType.TEXT_BACKGROUND will equate to the color stored in
 *     UIDefaults named "textBackground".</li>
 *   <li>ColorType.FOREGROUND will equate to the color stored in UIDefaults
 *     named "textForeground".</li>
 *   <li>ColorType.TEXT_FOREGROUND will equate to the color stored in
 *     UIDefaults named "textForeground".</li>
 * </ul>
 *
 * @param  ctx  context SynthContext identifying requester
 * @param  type Type of color being requested.
 *
 * @return Color to render with
 */
@Override
public Color getColorForState(SynthContext ctx, ColorType type) {
    String key = null;

    if (type == ColorType.BACKGROUND) {
        key = "background";
    } else if (type == ColorType.FOREGROUND) {

        // map FOREGROUND as TEXT_FOREGROUND
        key = "textForeground";
    } else if (type == ColorType.TEXT_BACKGROUND) {
        key = "textBackground";
    } else if (type == ColorType.TEXT_FOREGROUND) {
        key = "textForeground";
    } else if (type == ColorType.FOCUS) {
        key = "focus";
    } else if (type != null) {
        key = type.toString();
    } else {
        return defaultColor;
    }

    Color c = (Color) get(ctx, key);

    // if all else fails, return a default color (which is a
    // ColorUIResource)
    if (c == null)
        c = defaultColor;

    return c;
}
 
Example 19
Source File: GtkLFCustoms.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public Object[] createLookAndFeelCustomizationKeysAndValues() {
    if (ThemeValue.functioning()) {
        return new Object[] {
            //XXX once the JDK team has integrated support for standard
            //UIManager keys into 1.5 (not there as of b47), these can 
            //probably be deleted, resulting in a performance improvement:
            "control", control,
            "controlHighlight", new ThemeValue (Region.PANEL, ThemeValue.LIGHT, Color.LIGHT_GRAY), //NOI18N
            "controlShadow", new ThemeValue (Region.PANEL, ThemeValue.DARK, Color.DARK_GRAY), //NOI18N
            "controlDkShadow", new ThemeValue (Region.PANEL, ThemeValue.BLACK, Color.BLACK), //NOI18N
            "controlLtHighlight", new ThemeValue (Region.PANEL, ThemeValue.WHITE, Color.WHITE), //NOI18N
            "textText", new ThemeValue (Region.PANEL, ColorType.TEXT_FOREGROUND, Color.BLACK), //NOI18N
            "text", new ThemeValue (Region.PANEL, ColorType.TEXT_BACKGROUND, Color.GRAY), //NOI18N
            
            "tab_unsel_fill", control, //NOI18N
             
            "SplitPane.dividerSize", new Integer (2),  //NOI18N
            
            SYSTEMFONT, controlFont, //NOI18N
            USERFONT, controlFont, //NOI18N
            MENUFONT, controlFont, //NOI18N
            LISTFONT, controlFont, //NOI18N
            "Label.font", controlFont, //NOI18N
            "Panel.font", controlFont, //NOI18N

            // workaround: GTKLookAndFeel FileChooser is unusable, cannot
            // choose a dir and doesn't look native anyway.  We force MetalFileChooserUI
                    
            "FileChooserUI", "javax.swing.plaf.metal.MetalFileChooserUI", // NOI18N
            "FileView.computerIcon",       javax.swing.plaf.metal.MetalIconFactory.getTreeComputerIcon(), // NOI18N
            "FileView.hardDriveIcon",      javax.swing.plaf.metal.MetalIconFactory.getTreeHardDriveIcon(), // NOI18N
            "FileView.floppyDriveIcon",    javax.swing.plaf.metal.MetalIconFactory.getTreeFloppyDriveIcon(), // NOI18N
            "FileChooser.newFolderIcon",   javax.swing.plaf.metal.MetalIconFactory.getFileChooserNewFolderIcon(), // NOI18N
            "FileChooser.upFolderIcon",    javax.swing.plaf.metal.MetalIconFactory.getFileChooserUpFolderIcon(), // NOI18N
            "FileChooser.homeFolderIcon",  javax.swing.plaf.metal.MetalIconFactory.getFileChooserHomeFolderIcon(), // NOI18N
            "FileChooser.detailsViewIcon", javax.swing.plaf.metal.MetalIconFactory.getFileChooserDetailViewIcon(), // NOI18N
            "FileChooser.listViewIcon",    javax.swing.plaf.metal.MetalIconFactory.getFileChooserListViewIcon(), // NOI18N
            "FileChooser.usesSingleFilePane", Boolean.TRUE, // NOI18N
            "FileChooser.ancestorInputMap", // NOI18N
                        new UIDefaults.LazyInputMap(new Object[] {
                            "ESCAPE", "cancelSelection", // NOI18N
                            "F2", "editFileName", // NOI18N
                            "F5", "refresh", // NOI18N
                            "BACK_SPACE", "Go Up", // NOI18N
                            "ENTER", "approveSelection", // NOI18N
                            "ctrl ENTER", "approveSelection" // NOI18N
                        }),
            // special tree icons - only for property sheet
            "Tree.gtk_expandedIcon", new GTKExpandedIcon(),
            "Tree.gtk_collapsedIcon", new GTKCollapsedIcon(),
        };
    } else {
        Object[] result = new Object[] {
            TOOLBAR_UI, new UIDefaults.ProxyLazyValue("org.netbeans.swing.plaf.gtk.GtkToolbarUI"), //NOI18N
            // special tree icons - only for property sheet
            "Tree.gtk_expandedIcon", new GTKExpandedIcon(),
            "Tree.gtk_collapsedIcon", new GTKCollapsedIcon(),
        };
        return result;
    }
}