/** * Gets part of the image from input image icon. It basically takes a snapshot of the input image at {x, y} location * and the size is width x height. * * @param c the component where the returned icon will be used. The component is used as the ImageObserver. It * could be null. * @param icon the original icon. This is the larger icon where a sub-image will be created using this method. * @param x the x location of the sub-image, relative to the original icon. * @param y the y location of the sub-image, relative to the original icon. * @param width the width of the sub-image. It should be less than the width of the original icon. * @param height the height of the sub-image. It should be less than the height of the original icon. * @return an new image icon that was part of the input image icon. */ public static ImageIcon getIcon(Component c, ImageIcon icon, int x, int y, int width, int height) { return getIcon(c, icon, x, y, width, height, width, height); }
/** * Gets part of the image from input image icon. It basically takes a snapshot of the input image at {x, y} location * and the size is width x height. * * @param c the component where the returned icon will be used. The component is used as the ImageObserver. * It could be null. * @param icon the original icon. This is the larger icon where a small icon will be created using this * method. * @param x the x location of the smaller icon, relative to the original icon. * @param y the y location of the smaller icon, relative to the original icon. * @param width the width of the smaller icon. It should be less than the width of the original icon. * @param height the height of the smaller icon. It should be less than the height of the original icon. * @param imageType image type is defined in {@link BufferedImage}, such as {@link BufferedImage#TYPE_INT_ARGB}, * {@link BufferedImage#TYPE_INT_RGB} etc. * @return an new image icon that was part of the input image icon. */ public static ImageIcon getIcon(Component c, ImageIcon icon, int x, int y, int width, int height, int imageType) { return getIcon(c, icon, x, y, width, height, imageType, width, height); }
/** * Gets part of the image from input image icon. It basically takes a snapshot of the input image at {x, y} location * and the size is width x height, then resize it to a size of destWidth x destHeight. * * @param c the component where the returned icon will be used. The component is used as the ImageObserver. * It could be null. * @param icon the original icon. This is the larger icon where a sub-image will be created using this * method. * @param x the x location of the sub-image, relative to the original icon. * @param y the y location of the sub-image, relative to the original icon. * @param width the width of the sub-image. It should be less than the width of the original icon. * @param height the height of the sub-image. It should be less than the height of the original icon. * @param destWidth the width of the returned icon. The sub-image will be resize if the destWidth is not the same * as the width. * @param destHeight the height of the returned icon. The sub-image will be resize if the destHeight is not the same * as the height. * @return an new image icon that was part of the input image icon. */ public static ImageIcon getIcon(Component c, ImageIcon icon, int x, int y, int width, int height, int destWidth, int destHeight) { return getIcon(c, icon, x, y, width, height, BufferedImage.TYPE_INT_ARGB, destWidth, destHeight); }
/** * Gets the ImageIcon with an overlay icon on it. * * @param iconName the icon name as defined in IconSet. * @param size the icon size. If the size is not available, it will find the closest size that is larger * than the requested size. * @param overlayIconName the overlay icon name as defined in IconSet. The icons in the Overlay category are half * the size of the regular icons. So this method will take the middle portion of the overlay * icon specified in the overlayIconName and use it as the overlay icon. * @param location the location as defined in SwingConstants - CENTER, NORTH, SOUTH, WEST, EAST, NORTH_EAST, * NORTH_WEST, SOUTH_WEST and SOUTH_EAST. * @param insets the margin of the overlay icon to the border of the icon. * * @return the ImageIcon. */ public ImageIcon getOverlayImageIcon(String iconName, int size, String overlayIconName, int location, Insets insets) { ImageIcon icon = getImageIcon(iconName, size); if (icon == null) { return null; } ImageIcon overlay = getImageIcon(overlayIconName, size); if (overlay == null) { return icon; } // grab the middle portion of the overlay icon only overlay = IconsFactory.getIcon(null, overlay, size / 4, size / 4, size / 2, size / 2); return IconsFactory.getOverlayIcon(null, icon, overlay, location, insets); }
"MemoryStatusBarItem.fillColor", new ColorUIResource(0xfeba4f), "CollapsiblePane.downIcon", IconsFactory.getIcon(null, collapsiblePaneImage, 0, 0, collapsiblePaneSize, collapsiblePaneSize), "CollapsiblePane.upIcon", IconsFactory.getIcon(null, collapsiblePaneImage, 0, collapsiblePaneSize, collapsiblePaneSize, collapsiblePaneSize), "CollapsiblePanes.backgroundLt", new ColorUIResource(0xbfdbff), "CollapsiblePanes.backgroundDk", new ColorUIResource(0xbfdbff), "DockableFrameTitlePane.hideIcon", IconsFactory.getIcon(null, titleButtonImage, 0, 0, titleButtonSize, titleButtonSize), "DockableFrameTitlePane.unfloatIcon", IconsFactory.getIcon(null, titleButtonImage, 0, titleButtonSize, titleButtonSize, titleButtonSize), "DockableFrameTitlePane.floatIcon", IconsFactory.getIcon(null, titleButtonImage, 0, 2 * titleButtonSize, titleButtonSize, titleButtonSize),
ImageIcon collapsiblePaneImage = IconsFactory.getImageIcon(Office2003WindowsUtils.class, "icons/collapsible_pane_" + prefix + ".png"); // 20 x 20 ImageIcon collapsiblePaneMask = IconsFactory.getImageIcon(Office2003WindowsUtils.class, "icons/collapsible_pane_mask.png"); // 11 x 11 ImageIcon normalIcon = IconsFactory.getIcon(null, collapsiblePaneImage, 0, 0, SIZE, SIZE); ImageIcon emphasizedIcon = IconsFactory.getIcon(null, collapsiblePaneImage, SIZE, 0, SIZE, SIZE); ImageIcon downMark = IconsFactory.getIcon(null, collapsiblePaneMask, 0, 0, MASK_SIZE, MASK_SIZE); ImageIcon upMark = IconsFactory.getIcon(null, collapsiblePaneMask, 0, MASK_SIZE, MASK_SIZE, MASK_SIZE); uiDefaults = new Object[]{ "CollapsiblePane.contentBackground", ColorUtils.getDerivedColor(color, 0.98f),
ImageIcon collapsiblePaneImage = IconsFactory.getImageIcon(Office2003WindowsUtils.class, "icons/collapsible_pane_default.png"); // 20 x 20 ImageIcon collapsiblePaneMask = IconsFactory.getImageIcon(Office2003WindowsUtils.class, "icons/collapsible_pane_mask.png"); // 11 x 11 ImageIcon normalIcon = IconsFactory.getIcon(null, collapsiblePaneImage, 0, 0, SIZE, SIZE); ImageIcon emphasizedIcon = IconsFactory.getIcon(null, collapsiblePaneImage, SIZE, 0, SIZE, SIZE); ImageIcon downMark = IconsFactory.getIcon(null, collapsiblePaneMask, 0, 0, MASK_SIZE, MASK_SIZE); ImageIcon upMark = IconsFactory.getIcon(null, collapsiblePaneMask, 0, MASK_SIZE, MASK_SIZE, MASK_SIZE); uiDefaults = new Object[]{ "CollapsiblePane.contentBackground", controlLtHighlight,
ImageIcon collapsiblePaneImage = IconsFactory.getImageIcon(XertoMetalUtils.class, "icons/collapsible_pane_xerto.png"); // 12 x 12 ImageIcon collapsiblePaneMask = IconsFactory.getImageIcon(XertoMetalUtils.class, "icons/collapsible_pane_mask.png"); // 12 x 12 ImageIcon normalIcon = IconsFactory.getIcon(null, collapsiblePaneImage, 0, 0, SIZE, SIZE); ImageIcon emphasizedIcon = IconsFactory.getIcon(null, collapsiblePaneImage, SIZE, 0, SIZE, SIZE); ImageIcon downMark = IconsFactory.getIcon(null, collapsiblePaneMask, 0, 0, MASK_SIZE, MASK_SIZE); ImageIcon upMark = IconsFactory.getIcon(null, collapsiblePaneMask, 0, MASK_SIZE, MASK_SIZE, MASK_SIZE);
uiDefaults.put("DockableFrameTitlePane.hideIcon", IconsFactory.getIcon(null, titleButtonImage, 0, 0, titleButtonSize, titleButtonSize)); uiDefaults.put("DockableFrameTitlePane.unfloatIcon", IconsFactory.getIcon(null, titleButtonImage, 0, titleButtonSize, titleButtonSize, titleButtonSize)); uiDefaults.put("DockableFrameTitlePane.floatIcon", IconsFactory.getIcon(null, titleButtonImage, 0, 2 * titleButtonSize, titleButtonSize, titleButtonSize)); uiDefaults.put("DockableFrameTitlePane.autohideIcon", IconsFactory.getIcon(null, titleButtonImage, 0, 3 * titleButtonSize, titleButtonSize, titleButtonSize)); uiDefaults.put("DockableFrameTitlePane.stopAutohideIcon", IconsFactory.getIcon(null, titleButtonImage, 0, 4 * titleButtonSize, titleButtonSize, titleButtonSize)); uiDefaults.put("DockableFrameTitlePane.hideAutohideIcon", IconsFactory.getIcon(null, titleButtonImage, 0, 5 * titleButtonSize, titleButtonSize, titleButtonSize)); uiDefaults.put("DockableFrameTitlePane.maximizeIcon", IconsFactory.getIcon(null, titleButtonImage, 0, 6 * titleButtonSize, titleButtonSize, titleButtonSize)); uiDefaults.put("DockableFrameTitlePane.restoreIcon", IconsFactory.getIcon(null, titleButtonImage, 0, 7 * titleButtonSize, titleButtonSize, titleButtonSize)); uiDefaults.put("DockableFrameTitlePane.buttonGap", 4); // gap between buttons uiDefaults.put("DockableFrame.titleBorder", new BorderUIResource(BorderFactory.createEmptyBorder(1, 0, 2, 0)));
ImageIcon collapsiblePaneImage = IconsFactory.getImageIcon(XertoWindowsUtils.class, "icons/collapsible_pane_xerto.png"); // 12 x 12 ImageIcon collapsiblePaneMask = IconsFactory.getImageIcon(XertoWindowsUtils.class, "icons/collapsible_pane_mask.png"); // 12 x 12 ImageIcon normalIcon = IconsFactory.getIcon(null, collapsiblePaneImage, 0, 0, SIZE, SIZE); ImageIcon emphasizedIcon = IconsFactory.getIcon(null, collapsiblePaneImage, SIZE, 0, SIZE, SIZE); ImageIcon downMark = IconsFactory.getIcon(null, collapsiblePaneMask, 0, 0, MASK_SIZE, MASK_SIZE); ImageIcon upMark = IconsFactory.getIcon(null, collapsiblePaneMask, 0, MASK_SIZE, MASK_SIZE, MASK_SIZE);