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

下面列出了怎么用sun.awt.windows.ThemeReader的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: jdk1.8-source-analysis   文件: 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;
}
 
源代码2 项目: 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;
}
 
源代码3 项目: openjdk-jdk8u   文件: 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;
}
 
源代码4 项目: 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);
}
 
源代码5 项目: 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);
}
 
源代码6 项目: dragonwell8_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;
}
 
源代码7 项目: openjdk-8-source   文件: 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);
}
 
源代码8 项目: TencentKona-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;
}
 
源代码9 项目: 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);
}
 
源代码10 项目: openjdk-jdk9   文件: 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);
}
 
源代码11 项目: openjdk-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);
}
 
源代码12 项目: hottub   文件: 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);
}
 
源代码13 项目: jdk8u60   文件: 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;
}
 
源代码14 项目: openjdk-jdk9   文件: 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;
}
 
源代码15 项目: openjdk-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;
}
 
源代码16 项目: JDKSourceCode1.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;
}
 
源代码17 项目: openjdk-jdk8u   文件: XPStyle.java
/** Paint a skin at a defined position and size
 *  This method supports animation.
 *
 * @param g   the graphics context to use for painting
 * @param dx  the destination <i>x</i> coordinate
 * @param dy  the destination <i>y</i> coordinate
 * @param dw  the width of the area to fill, may cause
 *                  the image to be stretched or tiled
 * @param dh  the height of the area to fill, may cause
 *                  the image to be stretched or tiled
 * @param state which state to paint
 */
void paintSkin(Graphics g, int dx, int dy, int dw, int dh, State state) {
    if (XPStyle.getXP() == null) {
        return;
    }
    if (ThemeReader.isGetThemeTransitionDurationDefined()
          && component instanceof JComponent
          && SwingUtilities.getAncestorOfClass(CellRendererPane.class,
                                               component) == null) {
        AnimationController.paintSkin((JComponent) component, this,
                                      g, dx, dy, dw, dh, state);
    } else {
        paintSkinRaw(g, dx, dy, dw, dh, state);
    }
}
 
源代码18 项目: jdk8u_jdk   文件: 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);
}
 
源代码19 项目: jdk8u-jdk   文件: 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);
}
 
源代码20 项目: jdk1.8-source-analysis   文件: XPStyle.java
/** Paint a skin at a defined position and size
 *  This method supports animation.
 *
 * @param g   the graphics context to use for painting
 * @param dx  the destination <i>x</i> coordinate
 * @param dy  the destination <i>y</i> coordinate
 * @param dw  the width of the area to fill, may cause
 *                  the image to be stretched or tiled
 * @param dh  the height of the area to fill, may cause
 *                  the image to be stretched or tiled
 * @param state which state to paint
 */
void paintSkin(Graphics g, int dx, int dy, int dw, int dh, State state) {
    if (XPStyle.getXP() == null) {
        return;
    }
    if (ThemeReader.isGetThemeTransitionDurationDefined()
          && component instanceof JComponent
          && SwingUtilities.getAncestorOfClass(CellRendererPane.class,
                                               component) == null) {
        AnimationController.paintSkin((JComponent) component, this,
                                      g, dx, dy, dw, dh, state);
    } else {
        paintSkinRaw(g, dx, dy, dw, dh, state);
    }
}
 
源代码21 项目: openjdk-8-source   文件: 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);
}
 
源代码22 项目: hottub   文件: XPStyle.java
/** Paint a skin at a defined position and size
 *  This method supports animation.
 *
 * @param g   the graphics context to use for painting
 * @param dx  the destination <i>x</i> coordinate
 * @param dy  the destination <i>y</i> coordinate
 * @param dw  the width of the area to fill, may cause
 *                  the image to be stretched or tiled
 * @param dh  the height of the area to fill, may cause
 *                  the image to be stretched or tiled
 * @param state which state to paint
 */
void paintSkin(Graphics g, int dx, int dy, int dw, int dh, State state) {
    if (XPStyle.getXP() == null) {
        return;
    }
    if (ThemeReader.isGetThemeTransitionDurationDefined()
          && component instanceof JComponent
          && SwingUtilities.getAncestorOfClass(CellRendererPane.class,
                                               component) == null) {
        AnimationController.paintSkin((JComponent) component, this,
                                      g, dx, dy, dw, dh, state);
    } else {
        paintSkinRaw(g, dx, dy, dw, dh, state);
    }
}
 
源代码23 项目: jdk8u-dev-jdk   文件: XPStyle.java
Insets getContentMargin() {
    /* idk: it seems margins are the same for all 'big enough'
     * bounding rectangles.
     */
    int boundingWidth = 100;
    int boundingHeight = 100;

    Insets insets = ThemeReader.getThemeBackgroundContentMargins(
        part.getControlName(null), part.getValue(),
        0, boundingWidth, boundingHeight);
    return (insets != null) ? insets : new Insets(0, 0, 0, 0);
}
 
源代码24 项目: hottub   文件: 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);
}
 
源代码25 项目: TencentKona-8   文件: XPStyle.java
private static String getTypeEnumName(Component c, Part part, State state, Prop prop) {
    int enumValue = ThemeReader.getEnum(part.getControlName(c), part.getValue(),
                                        State.getValue(part, state),
                                        prop.getValue());
    if (enumValue == -1) {
        return null;
    }
    return TypeEnum.getTypeEnum(prop, enumValue).getName();
}
 
源代码26 项目: hottub   文件: XPStyle.java
Insets getContentMargin() {
    /* idk: it seems margins are the same for all 'big enough'
     * bounding rectangles.
     */
    int boundingWidth = 100;
    int boundingHeight = 100;

    Insets insets = ThemeReader.getThemeBackgroundContentMargins(
        part.getControlName(null), part.getValue(),
        0, boundingWidth, boundingHeight);
    return (insets != null) ? insets : new Insets(0, 0, 0, 0);
}
 
源代码27 项目: jdk8u60   文件: XPStyle.java
private static String getTypeEnumName(Component c, Part part, State state, Prop prop) {
    int enumValue = ThemeReader.getEnum(part.getControlName(c), part.getValue(),
                                        State.getValue(part, state),
                                        prop.getValue());
    if (enumValue == -1) {
        return null;
    }
    return TypeEnum.getTypeEnum(prop, enumValue).getName();
}
 
源代码28 项目: jdk8u60   文件: XPStyle.java
Insets getContentMargin() {
    /* idk: it seems margins are the same for all 'big enough'
     * bounding rectangles.
     */
    int boundingWidth = 100;
    int boundingHeight = 100;

    Insets insets = ThemeReader.getThemeBackgroundContentMargins(
        part.getControlName(null), part.getValue(),
        0, boundingWidth, boundingHeight);
    return (insets != null) ? insets : new Insets(0, 0, 0, 0);
}
 
源代码29 项目: jdk8u60   文件: XPStyle.java
/** Paint a skin at a defined position and size
 *  This method supports animation.
 *
 * @param g   the graphics context to use for painting
 * @param dx  the destination <i>x</i> coordinate
 * @param dy  the destination <i>y</i> coordinate
 * @param dw  the width of the area to fill, may cause
 *                  the image to be stretched or tiled
 * @param dh  the height of the area to fill, may cause
 *                  the image to be stretched or tiled
 * @param state which state to paint
 */
void paintSkin(Graphics g, int dx, int dy, int dw, int dh, State state) {
    if (XPStyle.getXP() == null) {
        return;
    }
    if (ThemeReader.isGetThemeTransitionDurationDefined()
          && component instanceof JComponent
          && SwingUtilities.getAncestorOfClass(CellRendererPane.class,
                                               component) == null) {
        AnimationController.paintSkin((JComponent) component, this,
                                      g, dx, dy, dw, dh, state);
    } else {
        paintSkinRaw(g, dx, dy, dw, dh, state);
    }
}
 
源代码30 项目: jdk8u-dev-jdk   文件: 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);
}
 
 类所在包
 类方法
 同包方法