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


Java IconInfo.getRawLength方法代码示例

本文整理汇总了Java中sun.awt.IconInfo.getRawLength方法的典型用法代码示例。如果您正苦于以下问题:Java IconInfo.getRawLength方法的具体用法?Java IconInfo.getRawLength怎么用?Java IconInfo.getRawLength使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sun.awt.IconInfo的用法示例。


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

示例1: normalizeIconImages

import sun.awt.IconInfo; //导入方法依赖的package包/类
static java.util.List<IconInfo> normalizeIconImages(java.util.List<IconInfo> icons) {
    java.util.List<IconInfo> result = new ArrayList<IconInfo>();
    int totalLength = 0;
    boolean haveLargeIcon = false;

    for (IconInfo icon : icons) {
        int width = icon.getWidth();
        int height = icon.getHeight();
        int length = icon.getRawLength();

        if (width > PREFERRED_SIZE_FOR_ICON || height > PREFERRED_SIZE_FOR_ICON) {
            if (haveLargeIcon) {
                continue;
            }
            int scaledWidth = width;
            int scaledHeight = height;
            while (scaledWidth > PREFERRED_SIZE_FOR_ICON ||
                   scaledHeight > PREFERRED_SIZE_FOR_ICON) {
                scaledWidth = scaledWidth / 2;
                scaledHeight = scaledHeight / 2;
            }

            icon.setScaledSize(scaledWidth, scaledHeight);
            length = icon.getRawLength();
        }

        if (totalLength + length <= MAXIMUM_BUFFER_LENGTH_NET_WM_ICON) {
            totalLength += length;
            result.add(icon);
            if (width > PREFERRED_SIZE_FOR_ICON || height > PREFERRED_SIZE_FOR_ICON) {
                haveLargeIcon = true;
            }
        }
    }

    if (iconLog.isLoggable(PlatformLogger.Level.FINEST)) {
        iconLog.finest(">>> Length_ of buffer of icons data: " + totalLength +
                       ", maximum length: " + MAXIMUM_BUFFER_LENGTH_NET_WM_ICON);
    }

    return result;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:43,代码来源:XWindowPeer.java

示例2: normalizeIconImages

import sun.awt.IconInfo; //导入方法依赖的package包/类
static java.util.List<IconInfo> normalizeIconImages(java.util.List<IconInfo> icons) {
    java.util.List<IconInfo> result = new ArrayList<IconInfo>();
    int totalLength = 0;
    boolean haveLargeIcon = false;

    for (IconInfo icon : icons) {
        int width = icon.getWidth();
        int height = icon.getHeight();
        int length = icon.getRawLength();

        if (width > PREFERRED_SIZE_FOR_ICON || height > PREFERRED_SIZE_FOR_ICON) {
            if (haveLargeIcon) {
                continue;
            }
            int scaledWidth = width;
            int scaledHeight = height;
            while (scaledWidth > PREFERRED_SIZE_FOR_ICON ||
                   scaledHeight > PREFERRED_SIZE_FOR_ICON) {
                scaledWidth = scaledWidth / 2;
                scaledHeight = scaledHeight / 2;
            }

            icon.setScaledSize(scaledWidth, scaledHeight);
            length = icon.getRawLength();
        }

        if (totalLength + length <= MAXIMUM_BUFFER_LENGTH_NET_WM_ICON) {
            totalLength += length;
            result.add(icon);
            if (width > PREFERRED_SIZE_FOR_ICON || height > PREFERRED_SIZE_FOR_ICON) {
                haveLargeIcon = true;
            }
        }
    }

    if (iconLog.isLoggable(PlatformLogger.FINEST)) {
        iconLog.finest(">>> Length_ of buffer of icons data: " + totalLength +
                       ", maximum length: " + MAXIMUM_BUFFER_LENGTH_NET_WM_ICON);
    }

    return result;
}
 
开发者ID:greghaskins,项目名称:openjdk-jdk7u-jdk,代码行数:43,代码来源:XWindowPeer.java


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