Java Code Examples for sun.awt.IconInfo#isValid()
The following examples show how to use
sun.awt.IconInfo#isValid() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XIconWindow.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * Sets icon image by selecting one of the images from the list. * The selected image is the one having the best matching size. */ void setIconImages(java.util.List<IconInfo> icons) { if (icons == null || icons.size() == 0) return; int minDiff = Integer.MAX_VALUE; Image min = null; for (IconInfo iconInfo : icons) { if (iconInfo.isValid()) { Image image = iconInfo.getImage(); Dimension dim = calcIconSize(image.getWidth(null), image.getHeight(null)); int widthDiff = Math.abs(dim.width - image.getWidth(null)); int heightDiff = Math.abs(image.getHeight(null) - dim.height); // "=" below allows to select the best matching icon if (minDiff >= (widthDiff + heightDiff)) { minDiff = (widthDiff + heightDiff); min = image; } } } if (min != null) { if (log.isLoggable(PlatformLogger.Level.FINER)) { log.finer("Icon: {0}x{1}", min.getWidth(null), min.getHeight(null)); } setIconImage(min); } }
Example 2
Source File: XIconWindow.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Sets icon image by selecting one of the images from the list. * The selected image is the one having the best matching size. */ void setIconImages(java.util.List<IconInfo> icons) { if (icons == null || icons.size() == 0) return; int minDiff = Integer.MAX_VALUE; Image min = null; for (IconInfo iconInfo : icons) { if (iconInfo.isValid()) { Image image = iconInfo.getImage(); Dimension dim = calcIconSize(image.getWidth(null), image.getHeight(null)); int widthDiff = Math.abs(dim.width - image.getWidth(null)); int heightDiff = Math.abs(image.getHeight(null) - dim.height); // "=" below allows to select the best matching icon if (minDiff >= (widthDiff + heightDiff)) { minDiff = (widthDiff + heightDiff); min = image; } } } if (min != null) { if (log.isLoggable(PlatformLogger.Level.FINER)) { log.finer("Icon: {0}x{1}", min.getWidth(null), min.getHeight(null)); } setIconImage(min); } }
Example 3
Source File: XIconWindow.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Sets icon image by selecting one of the images from the list. * The selected image is the one having the best matching size. */ void setIconImages(java.util.List<IconInfo> icons) { if (icons == null || icons.size() == 0) return; int minDiff = Integer.MAX_VALUE; Image min = null; for (IconInfo iconInfo : icons) { if (iconInfo.isValid()) { Image image = iconInfo.getImage(); Dimension dim = calcIconSize(image.getWidth(null), image.getHeight(null)); int widthDiff = Math.abs(dim.width - image.getWidth(null)); int heightDiff = Math.abs(image.getHeight(null) - dim.height); // "=" below allows to select the best matching icon if (minDiff >= (widthDiff + heightDiff)) { minDiff = (widthDiff + heightDiff); min = image; } } } if (min != null) { if (log.isLoggable(PlatformLogger.Level.FINER)) { log.finer("Icon: {0}x{1}", min.getWidth(null), min.getHeight(null)); } setIconImage(min); } }
Example 4
Source File: XIconWindow.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Sets icon image by selecting one of the images from the list. * The selected image is the one having the best matching size. */ void setIconImages(java.util.List<IconInfo> icons) { if (icons == null || icons.size() == 0) return; int minDiff = Integer.MAX_VALUE; Image min = null; for (IconInfo iconInfo : icons) { if (iconInfo.isValid()) { Image image = iconInfo.getImage(); Dimension dim = calcIconSize(image.getWidth(null), image.getHeight(null)); int widthDiff = Math.abs(dim.width - image.getWidth(null)); int heightDiff = Math.abs(image.getHeight(null) - dim.height); // "=" below allows to select the best matching icon if (minDiff >= (widthDiff + heightDiff)) { minDiff = (widthDiff + heightDiff); min = image; } } } if (min != null) { if (log.isLoggable(PlatformLogger.Level.FINER)) { log.finer("Icon: {0}x{1}", min.getWidth(null), min.getHeight(null)); } setIconImage(min); } }
Example 5
Source File: XIconWindow.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Sets icon image by selecting one of the images from the list. * The selected image is the one having the best matching size. */ void setIconImages(java.util.List<IconInfo> icons) { if (icons == null || icons.size() == 0) return; int minDiff = Integer.MAX_VALUE; Image min = null; for (IconInfo iconInfo : icons) { if (iconInfo.isValid()) { Image image = iconInfo.getImage(); Dimension dim = calcIconSize(image.getWidth(null), image.getHeight(null)); int widthDiff = Math.abs(dim.width - image.getWidth(null)); int heightDiff = Math.abs(image.getHeight(null) - dim.height); // "=" below allows to select the best matching icon if (minDiff >= (widthDiff + heightDiff)) { minDiff = (widthDiff + heightDiff); min = image; } } } if (min != null) { if (log.isLoggable(PlatformLogger.Level.FINER)) { log.finer("Icon: {0}x{1}", min.getWidth(null), min.getHeight(null)); } setIconImage(min); } }
Example 6
Source File: XIconWindow.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Sets icon image by selecting one of the images from the list. * The selected image is the one having the best matching size. */ void setIconImages(java.util.List<IconInfo> icons) { if (icons == null || icons.size() == 0) return; int minDiff = Integer.MAX_VALUE; Image min = null; for (IconInfo iconInfo : icons) { if (iconInfo.isValid()) { Image image = iconInfo.getImage(); Dimension dim = calcIconSize(image.getWidth(null), image.getHeight(null)); int widthDiff = Math.abs(dim.width - image.getWidth(null)); int heightDiff = Math.abs(image.getHeight(null) - dim.height); // "=" below allows to select the best matching icon if (minDiff >= (widthDiff + heightDiff)) { minDiff = (widthDiff + heightDiff); min = image; } } } if (min != null) { if (log.isLoggable(PlatformLogger.Level.FINER)) { log.finer("Icon: {0}x{1}", min.getWidth(null), min.getHeight(null)); } setIconImage(min); } }
Example 7
Source File: XIconWindow.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Sets icon image by selecting one of the images from the list. * The selected image is the one having the best matching size. */ void setIconImages(java.util.List<IconInfo> icons) { if (icons == null || icons.size() == 0) return; int minDiff = Integer.MAX_VALUE; Image min = null; for (IconInfo iconInfo : icons) { if (iconInfo.isValid()) { Image image = iconInfo.getImage(); Dimension dim = calcIconSize(image.getWidth(null), image.getHeight(null)); int widthDiff = Math.abs(dim.width - image.getWidth(null)); int heightDiff = Math.abs(image.getHeight(null) - dim.height); // "=" below allows to select the best matching icon if (minDiff >= (widthDiff + heightDiff)) { minDiff = (widthDiff + heightDiff); min = image; } } } if (min != null) { if (log.isLoggable(PlatformLogger.Level.FINER)) { log.finer("Icon: {0}x{1}", min.getWidth(null), min.getHeight(null)); } setIconImage(min); } }
Example 8
Source File: XIconWindow.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Sets icon image by selecting one of the images from the list. * The selected image is the one having the best matching size. */ void setIconImages(java.util.List<IconInfo> icons) { if (icons == null || icons.size() == 0) return; int minDiff = Integer.MAX_VALUE; Image min = null; for (IconInfo iconInfo : icons) { if (iconInfo.isValid()) { Image image = iconInfo.getImage(); Dimension dim = calcIconSize(image.getWidth(null), image.getHeight(null)); int widthDiff = Math.abs(dim.width - image.getWidth(null)); int heightDiff = Math.abs(image.getHeight(null) - dim.height); // "=" below allows to select the best matching icon if (minDiff >= (widthDiff + heightDiff)) { minDiff = (widthDiff + heightDiff); min = image; } } } if (min != null) { if (log.isLoggable(PlatformLogger.Level.FINER)) { log.finer("Icon: {0}x{1}", min.getWidth(null), min.getHeight(null)); } setIconImage(min); } }
Example 9
Source File: XIconWindow.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Sets icon image by selecting one of the images from the list. * The selected image is the one having the best matching size. */ void setIconImages(java.util.List<IconInfo> icons) { if (icons == null || icons.size() == 0) return; int minDiff = Integer.MAX_VALUE; Image min = null; for (IconInfo iconInfo : icons) { if (iconInfo.isValid()) { Image image = iconInfo.getImage(); Dimension dim = calcIconSize(image.getWidth(null), image.getHeight(null)); int widthDiff = Math.abs(dim.width - image.getWidth(null)); int heightDiff = Math.abs(image.getHeight(null) - dim.height); // "=" below allows to select the best matching icon if (minDiff >= (widthDiff + heightDiff)) { minDiff = (widthDiff + heightDiff); min = image; } } } if (min != null) { if (log.isLoggable(PlatformLogger.Level.FINER)) { log.finer("Icon: {0}x{1}", min.getWidth(null), min.getHeight(null)); } setIconImage(min); } }
Example 10
Source File: XIconWindow.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Sets icon image by selecting one of the images from the list. * The selected image is the one having the best matching size. */ void setIconImages(java.util.List<IconInfo> icons) { if (icons == null || icons.size() == 0) return; int minDiff = Integer.MAX_VALUE; Image min = null; for (IconInfo iconInfo : icons) { if (iconInfo.isValid()) { Image image = iconInfo.getImage(); Dimension dim = calcIconSize(image.getWidth(null), image.getHeight(null)); int widthDiff = Math.abs(dim.width - image.getWidth(null)); int heightDiff = Math.abs(image.getHeight(null) - dim.height); // "=" below allows to select the best matching icon if (minDiff >= (widthDiff + heightDiff)) { minDiff = (widthDiff + heightDiff); min = image; } } } if (min != null) { if (log.isLoggable(PlatformLogger.Level.FINER)) { log.finer("Icon: {0}x{1}", min.getWidth(null), min.getHeight(null)); } setIconImage(min); } }
Example 11
Source File: XIconWindow.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** * Sets icon image by selecting one of the images from the list. * The selected image is the one having the best matching size. */ void setIconImages(java.util.List<IconInfo> icons) { if (icons == null || icons.size() == 0) return; int minDiff = Integer.MAX_VALUE; Image min = null; for (IconInfo iconInfo : icons) { if (iconInfo.isValid()) { Image image = iconInfo.getImage(); Dimension dim = calcIconSize(image.getWidth(null), image.getHeight(null)); int widthDiff = Math.abs(dim.width - image.getWidth(null)); int heightDiff = Math.abs(image.getHeight(null) - dim.height); // "=" below allows to select the best matching icon if (minDiff >= (widthDiff + heightDiff)) { minDiff = (widthDiff + heightDiff); min = image; } } } if (min != null) { if (log.isLoggable(PlatformLogger.Level.FINER)) { log.finer("Icon: {0}x{1}", min.getWidth(null), min.getHeight(null)); } setIconImage(min); } }
Example 12
Source File: XIconWindow.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Sets icon image by selecting one of the images from the list. * The selected image is the one having the best matching size. */ void setIconImages(java.util.List<IconInfo> icons) { if (icons == null || icons.size() == 0) return; int minDiff = Integer.MAX_VALUE; Image min = null; for (IconInfo iconInfo : icons) { if (iconInfo.isValid()) { Image image = iconInfo.getImage(); Dimension dim = calcIconSize(image.getWidth(null), image.getHeight(null)); int widthDiff = Math.abs(dim.width - image.getWidth(null)); int heightDiff = Math.abs(image.getHeight(null) - dim.height); // "=" below allows to select the best matching icon if (minDiff >= (widthDiff + heightDiff)) { minDiff = (widthDiff + heightDiff); min = image; } } } if (min != null) { if (log.isLoggable(PlatformLogger.Level.FINER)) { log.finer("Icon: {0}x{1}", min.getWidth(null), min.getHeight(null)); } setIconImage(min); } }
Example 13
Source File: XIconWindow.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
/** * Sets icon image by selecting one of the images from the list. * The selected image is the one having the best matching size. */ void setIconImages(java.util.List<IconInfo> icons) { if (icons == null || icons.size() == 0) return; int minDiff = Integer.MAX_VALUE; Image min = null; for (IconInfo iconInfo : icons) { if (iconInfo.isValid()) { Image image = iconInfo.getImage(); Dimension dim = calcIconSize(image.getWidth(null), image.getHeight(null)); int widthDiff = Math.abs(dim.width - image.getWidth(null)); int heightDiff = Math.abs(image.getHeight(null) - dim.height); // "=" below allows to select the best matching icon if (minDiff >= (widthDiff + heightDiff)) { minDiff = (widthDiff + heightDiff); min = image; } } } if (min != null) { if (log.isLoggable(PlatformLogger.Level.FINER)) { log.finer("Icon: {0}x{1}", min.getWidth(null), min.getHeight(null)); } setIconImage(min); } }