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


Java JRSUIState类代码示例

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


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

示例1: getImage

import apple.laf.JRSUIState; //导入依赖的package包/类
public Image getImage(final GraphicsConfiguration config, final int w,
                      final int h, final int scale,
                      final JRSUIState state) {
    final int hash = hash(config, w, h, scale, state);
    final PixelCountSoftReference ref;
    lock.readLock().lock();
    try {
        ref = map.get(hash);
    } finally {
        lock.readLock().unlock();
    }
    // check reference has not been lost and the key truly matches,
    // in case of false positive hash match
    if (ref != null && ref.equals(config, w, h, scale, state)) {
        return ref.get();
    }
    return null;
}
 
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:19,代码来源:ImageCache.java

示例2: PixelCountSoftReference

import apple.laf.JRSUIState; //导入依赖的package包/类
PixelCountSoftReference(final Image referent,
        final ReferenceQueue<? super Image> q, final int pixelCount,
        final int hash, final GraphicsConfiguration config, final int w,
        final int h, final int scale, final JRSUIState state) {
    super(referent, q);
    this.pixelCount = pixelCount;
    this.hash = hash;
    this.config = config;
    this.w = w;
    this.h = h;
    this.scale = scale;
    this.state = state;
}
 
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:14,代码来源:ImageCache.java

示例3: createPainter

import apple.laf.JRSUIState; //导入依赖的package包/类
@Override
protected AquaPainter<? extends JRSUIState> createPainter() {
    JRSUIState state =  JRSUIState.getInstance();
    state.set(Widget.FRAME_LIST_BOX);
    return AquaPainter.<JRSUIState>create(state, 7, 7, 3, 3, 3, 3);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:7,代码来源:AquaScrollRegionBorder.java

示例4: setImage

import apple.laf.JRSUIState; //导入依赖的package包/类
/**
 * Sets the cached image for the specified constraints.
 *
 * @param image  The image to store in cache
 * @param config The graphics configuration, needed if cached image is a Volatile Image. Used as part of cache key
 * @param w      The image width, used as part of cache key
 * @param h      The image height, used as part of cache key
 * @param scale  The image scale factor, used as part of cache key
 * @return true if the image could be cached, false otherwise.
 */
public boolean setImage(final Image image,
        final GraphicsConfiguration config, final int w, final int h,
        final int scale, final JRSUIState state) {
    if (state.is(JRSUIConstants.Animating.YES)) {
        return false;
    }

    final int hash = hash(config, w, h, scale, state);

    lock.writeLock().lock();
    try {
        PixelCountSoftReference ref = map.get(hash);
        // check if currently in map
        if (ref != null && ref.get() == image) return true;

        // clear out old
        if (ref != null) {
            currentPixelCount -= ref.pixelCount;
            map.remove(hash);
        }

        // add new image to pixel count
        final int newPixelCount = image.getWidth(null) * image.getHeight(null);
        currentPixelCount += newPixelCount;
        // clean out lost references if not enough space
        if (currentPixelCount > maxPixelCount) {
            while ((ref = (PixelCountSoftReference)referenceQueue.poll()) != null) {
                //reference lost
                map.remove(ref.hash);
                currentPixelCount -= ref.pixelCount;
            }
        }

        // remove old items till there is enough free space
        if (currentPixelCount > maxPixelCount) {
            final Iterator<Map.Entry<Integer, PixelCountSoftReference>> mapIter = map.entrySet().iterator();
            while ((currentPixelCount > maxPixelCount) && mapIter.hasNext()) {
                final Map.Entry<Integer, PixelCountSoftReference> entry = mapIter.next();
                mapIter.remove();
                final Image img = entry.getValue().get();
                if (img != null) img.flush();
                currentPixelCount -= entry.getValue().pixelCount;
            }
        }
        // finally put new in map
        map.put(hash, new PixelCountSoftReference(image, referenceQueue, newPixelCount, hash, config, w, h, scale, state));
        return true;
    } finally {
        lock.writeLock().unlock();
    }
}
 
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:62,代码来源:ImageCache.java

示例5: equals

import apple.laf.JRSUIState; //导入依赖的package包/类
boolean equals(final GraphicsConfiguration config, final int w,
               final int h, final int scale, final JRSUIState state) {
    return config == this.config && w == this.w && h == this.h
            && scale == this.scale && state.equals(this.state);
}
 
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:6,代码来源:ImageCache.java


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