当前位置: 首页>>代码示例>>Java>>正文


Java ThemeReader类代码示例

本文整理汇总了Java中sun.awt.windows.ThemeReader的典型用法代码示例。如果您正苦于以下问题:Java ThemeReader类的具体用法?Java ThemeReader怎么用?Java ThemeReader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ThemeReader类属于sun.awt.windows包,在下文中一共展示了ThemeReader类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getXP

import sun.awt.windows.ThemeReader; //导入依赖的package包/类
/** 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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:28,代码来源:XPStyle.java

示例2: getColor

import sun.awt.windows.ThemeReader; //导入依赖的package包/类
/** 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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:XPStyle.java

示例3: getThemeTransitionDuration

import sun.awt.windows.ThemeReader; //导入依赖的package包/类
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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:XPStyle.java

示例4: paintToImage

import sun.awt.windows.ThemeReader; //导入依赖的package包/类
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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:XPStyle.java

示例5: getColor

import sun.awt.windows.ThemeReader; //导入依赖的package包/类
/** 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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:XPStyle.java

示例6: paintToImage

import sun.awt.windows.ThemeReader; //导入依赖的package包/类
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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:XPStyle.java

示例7: getXP

import sun.awt.windows.ThemeReader; //导入依赖的package包/类
/** 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;
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:28,代码来源:XPStyle.java


注:本文中的sun.awt.windows.ThemeReader类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。