Java 类sun.awt.windows.ThemeReader 实例源码

项目:OpenJSharp    文件:XPStyle.java   
/** Get the singleton instance of this class
 *
 * @return the singleton instance of this class or null if XP styles
 * are not active or if this is not Windows XP
 */
static synchronized XPStyle getXP() {
    if (themeActive == null) {
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        themeActive =
            (Boolean)toolkit.getDesktopProperty("win.xpstyle.themeActive");
        if (themeActive == null) {
            themeActive = Boolean.FALSE;
        }
        if (themeActive.booleanValue()) {
            GetPropertyAction propertyAction =
                new GetPropertyAction("swing.noxp");
            if (AccessController.doPrivileged(propertyAction) == null &&
                ThemeReader.isThemed() &&
                !(UIManager.getLookAndFeel()
                  instanceof WindowsClassicLookAndFeel)) {

                xp = new XPStyle();
            }
        }
    }
    return ThemeReader.isXPStyleEnabled() ? xp : null;
}
项目:OpenJSharp    文件:XPStyle.java   
/** Get a named <code>Color</code> value from the current style
 *
 * @param part a <code>Part</code>
 * @return a <code>Color</code> or null if key is not found
 *    in the current style
 */
synchronized Color getColor(Skin skin, Prop prop, Color fallback) {
    String key = skin.toString() + "." + prop.name();
    Part part = skin.part;
    Color color = colorMap.get(key);
    if (color == null) {
        color = ThemeReader.getColor(part.getControlName(null), part.getValue(),
                                     State.getValue(part, skin.state),
                                     prop.getValue());
        if (color != null) {
            color = new ColorUIResource(color);
            colorMap.put(key, color);
        }
    }
    return (color != null) ? color : fallback;
}
项目:OpenJSharp    文件:XPStyle.java   
long getThemeTransitionDuration(Component c, Part part, State stateFrom,
                                State stateTo, Prop prop) {
     return ThemeReader.getThemeTransitionDuration(part.getControlName(c),
                                      part.getValue(),
                                      State.getValue(part, stateFrom),
                                      State.getValue(part, stateTo),
                                      (prop != null) ? prop.getValue() : 0);
}
项目:OpenJSharp    文件:XPStyle.java   
protected void paintToImage(Component c, Image image, Graphics g,
                            int w, int h, Object[] args) {
    boolean accEnabled = false;
    Skin skin = (Skin)args[0];
    Part part = skin.part;
    State state = (State)args[1];
    if (state == null) {
        state = skin.state;
    }
    if (c == null) {
        c = skin.component;
    }
    BufferedImage bi = (BufferedImage)image;

    WritableRaster raster = bi.getRaster();
    DataBufferInt dbi = (DataBufferInt)raster.getDataBuffer();
    // Note that stealData() requires a markDirty() afterwards
    // since we modify the data in it.
    ThemeReader.paintBackground(SunWritableRaster.stealData(dbi, 0),
                                part.getControlName(c), part.getValue(),
                                State.getValue(part, state),
                                0, 0, w, h, w);
    SunWritableRaster.markDirty(dbi);
}
项目:jdk8u-jdk    文件:XPStyle.java   
/** Get the singleton instance of this class
 *
 * @return the singleton instance of this class or null if XP styles
 * are not active or if this is not Windows XP
 */
static synchronized XPStyle getXP() {
    if (themeActive == null) {
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        themeActive =
            (Boolean)toolkit.getDesktopProperty("win.xpstyle.themeActive");
        if (themeActive == null) {
            themeActive = Boolean.FALSE;
        }
        if (themeActive.booleanValue()) {
            GetPropertyAction propertyAction =
                new GetPropertyAction("swing.noxp");
            if (AccessController.doPrivileged(propertyAction) == null &&
                ThemeReader.isThemed() &&
                !(UIManager.getLookAndFeel()
                  instanceof WindowsClassicLookAndFeel)) {

                xp = new XPStyle();
            }
        }
    }
    return ThemeReader.isXPStyleEnabled() ? xp : null;
}
项目:jdk8u-jdk    文件:XPStyle.java   
/** Get a named <code>Color</code> value from the current style
 *
 * @param part a <code>Part</code>
 * @return a <code>Color</code> or null if key is not found
 *    in the current style
 */
synchronized Color getColor(Skin skin, Prop prop, Color fallback) {
    String key = skin.toString() + "." + prop.name();
    Part part = skin.part;
    Color color = colorMap.get(key);
    if (color == null) {
        color = ThemeReader.getColor(part.getControlName(null), part.getValue(),
                                     State.getValue(part, skin.state),
                                     prop.getValue());
        if (color != null) {
            color = new ColorUIResource(color);
            colorMap.put(key, color);
        }
    }
    return (color != null) ? color : fallback;
}
项目:jdk8u-jdk    文件:XPStyle.java   
protected void paintToImage(Component c, Image image, Graphics g,
                            int w, int h, Object[] args) {
    boolean accEnabled = false;
    Skin skin = (Skin)args[0];
    Part part = skin.part;
    State state = (State)args[1];
    if (state == null) {
        state = skin.state;
    }
    if (c == null) {
        c = skin.component;
    }
    BufferedImage bi = (BufferedImage)image;

    WritableRaster raster = bi.getRaster();
    DataBufferInt dbi = (DataBufferInt)raster.getDataBuffer();
    // Note that stealData() requires a markDirty() afterwards
    // since we modify the data in it.
    ThemeReader.paintBackground(SunWritableRaster.stealData(dbi, 0),
                                part.getControlName(c), part.getValue(),
                                State.getValue(part, state),
                                0, 0, w, h, w);
    SunWritableRaster.markDirty(dbi);
}
项目:openjdk-jdk10    文件:XPStyle.java   
/** Get the singleton instance of this class
 *
 * @return the singleton instance of this class or null if XP styles
 * are not active or if this is not Windows XP
 */
static synchronized XPStyle getXP() {
    if (themeActive == null) {
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        themeActive =
            (Boolean)toolkit.getDesktopProperty("win.xpstyle.themeActive");
        if (themeActive == null) {
            themeActive = Boolean.FALSE;
        }
        if (themeActive.booleanValue()) {
            GetPropertyAction propertyAction =
                new GetPropertyAction("swing.noxp");
            if (AccessController.doPrivileged(propertyAction) == null &&
                ThemeReader.isThemed() &&
                !(UIManager.getLookAndFeel()
                  instanceof WindowsClassicLookAndFeel)) {

                xp = new XPStyle();
            }
        }
    }
    return ThemeReader.isXPStyleEnabled() ? xp : null;
}
项目:openjdk-jdk10    文件:XPStyle.java   
/** Get a named <code>Color</code> value from the current style
 *
 * @return a <code>Color</code> or null if key is not found
 *    in the current style
 */
synchronized Color getColor(Skin skin, Prop prop, Color fallback) {
    String key = skin.toString() + "." + prop.name();
    Part part = skin.part;
    Color color = colorMap.get(key);
    if (color == null) {
        color = ThemeReader.getColor(part.getControlName(null), part.getValue(),
                                     State.getValue(part, skin.state),
                                     prop.getValue());
        if (color != null) {
            color = new ColorUIResource(color);
            colorMap.put(key, color);
        }
    }
    return (color != null) ? color : fallback;
}
项目:openjdk-jdk10    文件:XPStyle.java   
protected void paintToImage(Component c, Image image, Graphics g,
                            int w, int h, Object[] args) {
    Skin skin = (Skin)args[0];
    Part part = skin.part;
    State state = (State)args[1];
    if (state == null) {
        state = skin.state;
    }
    if (c == null) {
        c = skin.component;
    }
    BufferedImage bi = (BufferedImage)image;
    w = bi.getWidth();
    h = bi.getHeight();

    WritableRaster raster = bi.getRaster();
    DataBufferInt dbi = (DataBufferInt)raster.getDataBuffer();
    // Note that stealData() requires a markDirty() afterwards
    // since we modify the data in it.
    ThemeReader.paintBackground(SunWritableRaster.stealData(dbi, 0),
                                part.getControlName(c), part.getValue(),
                                State.getValue(part, state),
                                0, 0, w, h, w);
    SunWritableRaster.markDirty(dbi);
}
项目:openjdk9    文件:XPStyle.java   
/** Get the singleton instance of this class
 *
 * @return the singleton instance of this class or null if XP styles
 * are not active or if this is not Windows XP
 */
static synchronized XPStyle getXP() {
    if (themeActive == null) {
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        themeActive =
            (Boolean)toolkit.getDesktopProperty("win.xpstyle.themeActive");
        if (themeActive == null) {
            themeActive = Boolean.FALSE;
        }
        if (themeActive.booleanValue()) {
            GetPropertyAction propertyAction =
                new GetPropertyAction("swing.noxp");
            if (AccessController.doPrivileged(propertyAction) == null &&
                ThemeReader.isThemed() &&
                !(UIManager.getLookAndFeel()
                  instanceof WindowsClassicLookAndFeel)) {

                xp = new XPStyle();
            }
        }
    }
    return ThemeReader.isXPStyleEnabled() ? xp : null;
}
项目:openjdk9    文件:XPStyle.java   
/** Get a named <code>Color</code> value from the current style
 *
 * @param part a <code>Part</code>
 * @return a <code>Color</code> or null if key is not found
 *    in the current style
 */
synchronized Color getColor(Skin skin, Prop prop, Color fallback) {
    String key = skin.toString() + "." + prop.name();
    Part part = skin.part;
    Color color = colorMap.get(key);
    if (color == null) {
        color = ThemeReader.getColor(part.getControlName(null), part.getValue(),
                                     State.getValue(part, skin.state),
                                     prop.getValue());
        if (color != null) {
            color = new ColorUIResource(color);
            colorMap.put(key, color);
        }
    }
    return (color != null) ? color : fallback;
}
项目:openjdk9    文件:XPStyle.java   
protected void paintToImage(Component c, Image image, Graphics g,
                            int w, int h, Object[] args) {
    boolean accEnabled = false;
    Skin skin = (Skin)args[0];
    Part part = skin.part;
    State state = (State)args[1];
    if (state == null) {
        state = skin.state;
    }
    if (c == null) {
        c = skin.component;
    }
    BufferedImage bi = (BufferedImage)image;

    WritableRaster raster = bi.getRaster();
    DataBufferInt dbi = (DataBufferInt)raster.getDataBuffer();
    // Note that stealData() requires a markDirty() afterwards
    // since we modify the data in it.
    ThemeReader.paintBackground(SunWritableRaster.stealData(dbi, 0),
                                part.getControlName(c), part.getValue(),
                                State.getValue(part, state),
                                0, 0, w, h, w);
    SunWritableRaster.markDirty(dbi);
}
项目:jdk8u_jdk    文件:XPStyle.java   
/** Get the singleton instance of this class
 *
 * @return the singleton instance of this class or null if XP styles
 * are not active or if this is not Windows XP
 */
static synchronized XPStyle getXP() {
    if (themeActive == null) {
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        themeActive =
            (Boolean)toolkit.getDesktopProperty("win.xpstyle.themeActive");
        if (themeActive == null) {
            themeActive = Boolean.FALSE;
        }
        if (themeActive.booleanValue()) {
            GetPropertyAction propertyAction =
                new GetPropertyAction("swing.noxp");
            if (AccessController.doPrivileged(propertyAction) == null &&
                ThemeReader.isThemed() &&
                !(UIManager.getLookAndFeel()
                  instanceof WindowsClassicLookAndFeel)) {

                xp = new XPStyle();
            }
        }
    }
    return ThemeReader.isXPStyleEnabled() ? xp : null;
}
项目:jdk8u_jdk    文件:XPStyle.java   
/** Get a named <code>Color</code> value from the current style
 *
 * @param part a <code>Part</code>
 * @return a <code>Color</code> or null if key is not found
 *    in the current style
 */
synchronized Color getColor(Skin skin, Prop prop, Color fallback) {
    String key = skin.toString() + "." + prop.name();
    Part part = skin.part;
    Color color = colorMap.get(key);
    if (color == null) {
        color = ThemeReader.getColor(part.getControlName(null), part.getValue(),
                                     State.getValue(part, skin.state),
                                     prop.getValue());
        if (color != null) {
            color = new ColorUIResource(color);
            colorMap.put(key, color);
        }
    }
    return (color != null) ? color : fallback;
}
项目:jdk8u_jdk    文件:XPStyle.java   
protected void paintToImage(Component c, Image image, Graphics g,
                            int w, int h, Object[] args) {
    Skin skin = (Skin)args[0];
    Part part = skin.part;
    State state = (State)args[1];
    if (state == null) {
        state = skin.state;
    }
    if (c == null) {
        c = skin.component;
    }
    BufferedImage bi = (BufferedImage)image;
    w = bi.getWidth();
    h = bi.getHeight();

    WritableRaster raster = bi.getRaster();
    DataBufferInt dbi = (DataBufferInt)raster.getDataBuffer();
    // Note that stealData() requires a markDirty() afterwards
    // since we modify the data in it.
    ThemeReader.paintBackground(SunWritableRaster.stealData(dbi, 0),
                                part.getControlName(c), part.getValue(),
                                State.getValue(part, state),
                                0, 0, w, h, w);
    SunWritableRaster.markDirty(dbi);
}
项目:lookaside_java-1.8.0-openjdk    文件:XPStyle.java   
/** Get the singleton instance of this class
 *
 * @return the singleton instance of this class or null if XP styles
 * are not active or if this is not Windows XP
 */
static synchronized XPStyle getXP() {
    if (themeActive == null) {
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        themeActive =
            (Boolean)toolkit.getDesktopProperty("win.xpstyle.themeActive");
        if (themeActive == null) {
            themeActive = Boolean.FALSE;
        }
        if (themeActive.booleanValue()) {
            GetPropertyAction propertyAction =
                new GetPropertyAction("swing.noxp");
            if (AccessController.doPrivileged(propertyAction) == null &&
                ThemeReader.isThemed() &&
                !(UIManager.getLookAndFeel()
                  instanceof WindowsClassicLookAndFeel)) {

                xp = new XPStyle();
            }
        }
    }
    return ThemeReader.isXPStyleEnabled() ? xp : null;
}
项目:lookaside_java-1.8.0-openjdk    文件:XPStyle.java   
/** Get a named <code>Color</code> value from the current style
 *
 * @param part a <code>Part</code>
 * @return a <code>Color</code> or null if key is not found
 *    in the current style
 */
synchronized Color getColor(Skin skin, Prop prop, Color fallback) {
    String key = skin.toString() + "." + prop.name();
    Part part = skin.part;
    Color color = colorMap.get(key);
    if (color == null) {
        color = ThemeReader.getColor(part.getControlName(null), part.getValue(),
                                     State.getValue(part, skin.state),
                                     prop.getValue());
        if (color != null) {
            color = new ColorUIResource(color);
            colorMap.put(key, color);
        }
    }
    return (color != null) ? color : fallback;
}
项目:lookaside_java-1.8.0-openjdk    文件:XPStyle.java   
protected void paintToImage(Component c, Image image, Graphics g,
                            int w, int h, Object[] args) {
    boolean accEnabled = false;
    Skin skin = (Skin)args[0];
    Part part = skin.part;
    State state = (State)args[1];
    if (state == null) {
        state = skin.state;
    }
    if (c == null) {
        c = skin.component;
    }
    BufferedImage bi = (BufferedImage)image;

    WritableRaster raster = bi.getRaster();
    DataBufferInt dbi = (DataBufferInt)raster.getDataBuffer();
    // Note that stealData() requires a markDirty() afterwards
    // since we modify the data in it.
    ThemeReader.paintBackground(SunWritableRaster.stealData(dbi, 0),
                                part.getControlName(c), part.getValue(),
                                State.getValue(part, state),
                                0, 0, w, h, w);
    SunWritableRaster.markDirty(dbi);
}
项目:infobip-open-jdk-8    文件:XPStyle.java   
/** Get the singleton instance of this class
 *
 * @return the singleton instance of this class or null if XP styles
 * are not active or if this is not Windows XP
 */
static synchronized XPStyle getXP() {
    if (themeActive == null) {
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        themeActive =
            (Boolean)toolkit.getDesktopProperty("win.xpstyle.themeActive");
        if (themeActive == null) {
            themeActive = Boolean.FALSE;
        }
        if (themeActive.booleanValue()) {
            GetPropertyAction propertyAction =
                new GetPropertyAction("swing.noxp");
            if (AccessController.doPrivileged(propertyAction) == null &&
                ThemeReader.isThemed() &&
                !(UIManager.getLookAndFeel()
                  instanceof WindowsClassicLookAndFeel)) {

                xp = new XPStyle();
            }
        }
    }
    return ThemeReader.isXPStyleEnabled() ? xp : null;
}
项目:infobip-open-jdk-8    文件:XPStyle.java   
/** Get a named <code>Color</code> value from the current style
 *
 * @param part a <code>Part</code>
 * @return a <code>Color</code> or null if key is not found
 *    in the current style
 */
synchronized Color getColor(Skin skin, Prop prop, Color fallback) {
    String key = skin.toString() + "." + prop.name();
    Part part = skin.part;
    Color color = colorMap.get(key);
    if (color == null) {
        color = ThemeReader.getColor(part.getControlName(null), part.getValue(),
                                     State.getValue(part, skin.state),
                                     prop.getValue());
        if (color != null) {
            color = new ColorUIResource(color);
            colorMap.put(key, color);
        }
    }
    return (color != null) ? color : fallback;
}
项目:infobip-open-jdk-8    文件:XPStyle.java   
protected void paintToImage(Component c, Image image, Graphics g,
                            int w, int h, Object[] args) {
    boolean accEnabled = false;
    Skin skin = (Skin)args[0];
    Part part = skin.part;
    State state = (State)args[1];
    if (state == null) {
        state = skin.state;
    }
    if (c == null) {
        c = skin.component;
    }
    BufferedImage bi = (BufferedImage)image;

    WritableRaster raster = bi.getRaster();
    DataBufferInt dbi = (DataBufferInt)raster.getDataBuffer();
    // Note that stealData() requires a markDirty() afterwards
    // since we modify the data in it.
    ThemeReader.paintBackground(SunWritableRaster.stealData(dbi, 0),
                                part.getControlName(c), part.getValue(),
                                State.getValue(part, state),
                                0, 0, w, h, w);
    SunWritableRaster.markDirty(dbi);
}
项目:jdk8u-dev-jdk    文件:XPStyle.java   
/** Get the singleton instance of this class
 *
 * @return the singleton instance of this class or null if XP styles
 * are not active or if this is not Windows XP
 */
static synchronized XPStyle getXP() {
    if (themeActive == null) {
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        themeActive =
            (Boolean)toolkit.getDesktopProperty("win.xpstyle.themeActive");
        if (themeActive == null) {
            themeActive = Boolean.FALSE;
        }
        if (themeActive.booleanValue()) {
            GetPropertyAction propertyAction =
                new GetPropertyAction("swing.noxp");
            if (AccessController.doPrivileged(propertyAction) == null &&
                ThemeReader.isThemed() &&
                !(UIManager.getLookAndFeel()
                  instanceof WindowsClassicLookAndFeel)) {

                xp = new XPStyle();
            }
        }
    }
    return ThemeReader.isXPStyleEnabled() ? xp : null;
}
项目:jdk8u-dev-jdk    文件:XPStyle.java   
/** Get a named <code>Color</code> value from the current style
 *
 * @param part a <code>Part</code>
 * @return a <code>Color</code> or null if key is not found
 *    in the current style
 */
synchronized Color getColor(Skin skin, Prop prop, Color fallback) {
    String key = skin.toString() + "." + prop.name();
    Part part = skin.part;
    Color color = colorMap.get(key);
    if (color == null) {
        color = ThemeReader.getColor(part.getControlName(null), part.getValue(),
                                     State.getValue(part, skin.state),
                                     prop.getValue());
        if (color != null) {
            color = new ColorUIResource(color);
            colorMap.put(key, color);
        }
    }
    return (color != null) ? color : fallback;
}
项目:jdk8u-dev-jdk    文件:XPStyle.java   
protected void paintToImage(Component c, Image image, Graphics g,
                            int w, int h, Object[] args) {
    boolean accEnabled = false;
    Skin skin = (Skin)args[0];
    Part part = skin.part;
    State state = (State)args[1];
    if (state == null) {
        state = skin.state;
    }
    if (c == null) {
        c = skin.component;
    }
    BufferedImage bi = (BufferedImage)image;

    WritableRaster raster = bi.getRaster();
    DataBufferInt dbi = (DataBufferInt)raster.getDataBuffer();
    // Note that stealData() requires a markDirty() afterwards
    // since we modify the data in it.
    ThemeReader.paintBackground(SunWritableRaster.stealData(dbi, 0),
                                part.getControlName(c), part.getValue(),
                                State.getValue(part, state),
                                0, 0, w, h, w);
    SunWritableRaster.markDirty(dbi);
}
项目:jdk7-jdk    文件:XPStyle.java   
/** Get the singleton instance of this class
 *
 * @return the singleton instance of this class or null if XP styles
 * are not active or if this is not Windows XP
 */
static synchronized XPStyle getXP() {
    if (themeActive == null) {
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        themeActive =
            (Boolean)toolkit.getDesktopProperty("win.xpstyle.themeActive");
        if (themeActive == null) {
            themeActive = Boolean.FALSE;
        }
        if (themeActive.booleanValue()) {
            GetPropertyAction propertyAction =
                new GetPropertyAction("swing.noxp");
            if (AccessController.doPrivileged(propertyAction) == null &&
                ThemeReader.isThemed() &&
                !(UIManager.getLookAndFeel()
                  instanceof WindowsClassicLookAndFeel)) {

                xp = new XPStyle();
            }
        }
    }
    return xp;
}
项目:jdk7-jdk    文件:XPStyle.java   
/** Get a named <code>Color</code> value from the current style
 *
 * @param part a <code>Part</code>
 * @return a <code>Color</code> or null if key is not found
 *    in the current style
 */
synchronized Color getColor(Skin skin, Prop prop, Color fallback) {
    String key = skin.toString() + "." + prop.name();
    Part part = skin.part;
    Color color = colorMap.get(key);
    if (color == null) {
        color = ThemeReader.getColor(part.getControlName(null), part.getValue(),
                                     State.getValue(part, skin.state),
                                     prop.getValue());
        if (color != null) {
            color = new ColorUIResource(color);
            colorMap.put(key, color);
        }
    }
    return (color != null) ? color : fallback;
}
项目:jdk7-jdk    文件:XPStyle.java   
protected void paintToImage(Component c, Image image, Graphics g,
                            int w, int h, Object[] args) {
    boolean accEnabled = false;
    Skin skin = (Skin)args[0];
    Part part = skin.part;
    State state = (State)args[1];
    if (state == null) {
        state = skin.state;
    }
    if (c == null) {
        c = skin.component;
    }
    BufferedImage bi = (BufferedImage)image;

    WritableRaster raster = bi.getRaster();
    DataBufferInt dbi = (DataBufferInt)raster.getDataBuffer();
    // Note that stealData() requires a markDirty() afterwards
    // since we modify the data in it.
    ThemeReader.paintBackground(SunWritableRaster.stealData(dbi, 0),
                                part.getControlName(c), part.getValue(),
                                State.getValue(part, state),
                                0, 0, w, h, w);
    SunWritableRaster.markDirty(dbi);
}
项目:openjdk-source-code-learn    文件:XPStyle.java   
/** Get the singleton instance of this class
 *
 * @return the singleton instance of this class or null if XP styles
 * are not active or if this is not Windows XP
 */
static synchronized XPStyle getXP() {
    if (themeActive == null) {
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        themeActive =
            (Boolean)toolkit.getDesktopProperty("win.xpstyle.themeActive");
        if (themeActive == null) {
            themeActive = Boolean.FALSE;
        }
        if (themeActive.booleanValue()) {
            GetPropertyAction propertyAction =
                new GetPropertyAction("swing.noxp");
            if (AccessController.doPrivileged(propertyAction) == null &&
                ThemeReader.isThemed() &&
                !(UIManager.getLookAndFeel()
                  instanceof WindowsClassicLookAndFeel)) {

                xp = new XPStyle();
            }
        }
    }
    return xp;
}
项目:openjdk-source-code-learn    文件:XPStyle.java   
/** Get a named <code>Color</code> value from the current style
 *
 * @param part a <code>Part</code>
 * @return a <code>Color</code> or null if key is not found
 *    in the current style
 */
synchronized Color getColor(Skin skin, Prop prop, Color fallback) {
    String key = skin.toString() + "." + prop.name();
    Part part = skin.part;
    Color color = colorMap.get(key);
    if (color == null) {
        color = ThemeReader.getColor(part.getControlName(null), part.getValue(),
                                     State.getValue(part, skin.state),
                                     prop.getValue());
        if (color != null) {
            color = new ColorUIResource(color);
            colorMap.put(key, color);
        }
    }
    return (color != null) ? color : fallback;
}
项目:openjdk-source-code-learn    文件:XPStyle.java   
protected void paintToImage(Component c, Image image, Graphics g,
                            int w, int h, Object[] args) {
    boolean accEnabled = false;
    Skin skin = (Skin)args[0];
    Part part = skin.part;
    State state = (State)args[1];
    if (state == null) {
        state = skin.state;
    }
    if (c == null) {
        c = skin.component;
    }
    BufferedImage bi = (BufferedImage)image;

    WritableRaster raster = bi.getRaster();
    DataBufferInt dbi = (DataBufferInt)raster.getDataBuffer();
    // Note that stealData() requires a markDirty() afterwards
    // since we modify the data in it.
    ThemeReader.paintBackground(SunWritableRaster.stealData(dbi, 0),
                                part.getControlName(c), part.getValue(),
                                State.getValue(part, state),
                                0, 0, w, h, w);
    SunWritableRaster.markDirty(dbi);
}
项目:OLD-OpenJDK8    文件:XPStyle.java   
/** Get the singleton instance of this class
 *
 * @return the singleton instance of this class or null if XP styles
 * are not active or if this is not Windows XP
 */
static synchronized XPStyle getXP() {
    if (themeActive == null) {
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        themeActive =
            (Boolean)toolkit.getDesktopProperty("win.xpstyle.themeActive");
        if (themeActive == null) {
            themeActive = Boolean.FALSE;
        }
        if (themeActive.booleanValue()) {
            GetPropertyAction propertyAction =
                new GetPropertyAction("swing.noxp");
            if (AccessController.doPrivileged(propertyAction) == null &&
                ThemeReader.isThemed() &&
                !(UIManager.getLookAndFeel()
                  instanceof WindowsClassicLookAndFeel)) {

                xp = new XPStyle();
            }
        }
    }
    return xp;
}
项目:OLD-OpenJDK8    文件:XPStyle.java   
/** Get a named <code>Color</code> value from the current style
 *
 * @param part a <code>Part</code>
 * @return a <code>Color</code> or null if key is not found
 *    in the current style
 */
synchronized Color getColor(Skin skin, Prop prop, Color fallback) {
    String key = skin.toString() + "." + prop.name();
    Part part = skin.part;
    Color color = colorMap.get(key);
    if (color == null) {
        color = ThemeReader.getColor(part.getControlName(null), part.getValue(),
                                     State.getValue(part, skin.state),
                                     prop.getValue());
        if (color != null) {
            color = new ColorUIResource(color);
            colorMap.put(key, color);
        }
    }
    return (color != null) ? color : fallback;
}
项目:OLD-OpenJDK8    文件:XPStyle.java   
protected void paintToImage(Component c, Image image, Graphics g,
                            int w, int h, Object[] args) {
    boolean accEnabled = false;
    Skin skin = (Skin)args[0];
    Part part = skin.part;
    State state = (State)args[1];
    if (state == null) {
        state = skin.state;
    }
    if (c == null) {
        c = skin.component;
    }
    BufferedImage bi = (BufferedImage)image;

    WritableRaster raster = bi.getRaster();
    DataBufferInt dbi = (DataBufferInt)raster.getDataBuffer();
    // Note that stealData() requires a markDirty() afterwards
    // since we modify the data in it.
    ThemeReader.paintBackground(SunWritableRaster.stealData(dbi, 0),
                                part.getControlName(c), part.getValue(),
                                State.getValue(part, state),
                                0, 0, w, h, w);
    SunWritableRaster.markDirty(dbi);
}
项目:openjdk-jdk7u-jdk    文件:XPStyle.java   
/** Get the singleton instance of this class
 *
 * @return the singleton instance of this class or null if XP styles
 * are not active or if this is not Windows XP
 */
static synchronized XPStyle getXP() {
    if (themeActive == null) {
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        themeActive =
            (Boolean)toolkit.getDesktopProperty("win.xpstyle.themeActive");
        if (themeActive == null) {
            themeActive = Boolean.FALSE;
        }
        if (themeActive.booleanValue()) {
            GetPropertyAction propertyAction =
                new GetPropertyAction("swing.noxp");
            if (AccessController.doPrivileged(propertyAction) == null &&
                ThemeReader.isThemed() &&
                !(UIManager.getLookAndFeel()
                  instanceof WindowsClassicLookAndFeel)) {

                xp = new XPStyle();
            }
        }
    }
    return xp;
}
项目:openjdk-jdk7u-jdk    文件:XPStyle.java   
/** Get a named <code>Color</code> value from the current style
 *
 * @param part a <code>Part</code>
 * @return a <code>Color</code> or null if key is not found
 *    in the current style
 */
synchronized Color getColor(Skin skin, Prop prop, Color fallback) {
    String key = skin.toString() + "." + prop.name();
    Part part = skin.part;
    Color color = colorMap.get(key);
    if (color == null) {
        color = ThemeReader.getColor(part.getControlName(null), part.getValue(),
                                     State.getValue(part, skin.state),
                                     prop.getValue());
        if (color != null) {
            color = new ColorUIResource(color);
            colorMap.put(key, color);
        }
    }
    return (color != null) ? color : fallback;
}
项目:openjdk-jdk7u-jdk    文件:XPStyle.java   
protected void paintToImage(Component c, Image image, Graphics g,
                            int w, int h, Object[] args) {
    boolean accEnabled = false;
    Skin skin = (Skin)args[0];
    Part part = skin.part;
    State state = (State)args[1];
    if (state == null) {
        state = skin.state;
    }
    if (c == null) {
        c = skin.component;
    }
    BufferedImage bi = (BufferedImage)image;

    WritableRaster raster = bi.getRaster();
    DataBufferInt dbi = (DataBufferInt)raster.getDataBuffer();
    // Note that stealData() requires a markDirty() afterwards
    // since we modify the data in it.
    ThemeReader.paintBackground(SunWritableRaster.stealData(dbi, 0),
                                part.getControlName(c), part.getValue(),
                                State.getValue(part, state),
                                0, 0, w, h, w);
    SunWritableRaster.markDirty(dbi);
}
项目:openjdk-icedtea7    文件:XPStyle.java   
/** Get the singleton instance of this class
 *
 * @return the singleton instance of this class or null if XP styles
 * are not active or if this is not Windows XP
 */
static synchronized XPStyle getXP() {
    if (themeActive == null) {
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        themeActive =
            (Boolean)toolkit.getDesktopProperty("win.xpstyle.themeActive");
        if (themeActive == null) {
            themeActive = Boolean.FALSE;
        }
        if (themeActive.booleanValue()) {
            GetPropertyAction propertyAction =
                new GetPropertyAction("swing.noxp");
            if (AccessController.doPrivileged(propertyAction) == null &&
                ThemeReader.isThemed() &&
                !(UIManager.getLookAndFeel()
                  instanceof WindowsClassicLookAndFeel)) {

                xp = new XPStyle();
            }
        }
    }
    return xp;
}
项目:openjdk-icedtea7    文件:XPStyle.java   
/** Get a named <code>Color</code> value from the current style
 *
 * @param part a <code>Part</code>
 * @return a <code>Color</code> or null if key is not found
 *    in the current style
 */
synchronized Color getColor(Skin skin, Prop prop, Color fallback) {
    String key = skin.toString() + "." + prop.name();
    Part part = skin.part;
    Color color = colorMap.get(key);
    if (color == null) {
        color = ThemeReader.getColor(part.getControlName(null), part.getValue(),
                                     State.getValue(part, skin.state),
                                     prop.getValue());
        if (color != null) {
            color = new ColorUIResource(color);
            colorMap.put(key, color);
        }
    }
    return (color != null) ? color : fallback;
}
项目:openjdk-icedtea7    文件:XPStyle.java   
protected void paintToImage(Component c, Image image, Graphics g,
                            int w, int h, Object[] args) {
    boolean accEnabled = false;
    Skin skin = (Skin)args[0];
    Part part = skin.part;
    State state = (State)args[1];
    if (state == null) {
        state = skin.state;
    }
    if (c == null) {
        c = skin.component;
    }
    BufferedImage bi = (BufferedImage)image;

    WritableRaster raster = bi.getRaster();
    DataBufferInt dbi = (DataBufferInt)raster.getDataBuffer();
    // Note that stealData() requires a markDirty() afterwards
    // since we modify the data in it.
    ThemeReader.paintBackground(SunWritableRaster.stealData(dbi, 0),
                                part.getControlName(c), part.getValue(),
                                State.getValue(part, state),
                                0, 0, w, h, w);
    SunWritableRaster.markDirty(dbi);
}