下面列出了javax.swing.ImageIcon#getImageObserver ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* @param navigationManager manager for these point markers
* @param name the name for this point marker
* @param desc the description associated with this point marker
* @param priority to sort out what displays on top, higher is more likely to be on top
* @param showMarkers true indicates to show area markers (on the left side of the browser.)
* @param showNavigation true indicates to show area navigation markers (on the right side of the browser.)
* @param colorBackground colorBackground the color of marked areas in navigation bar
* If color is null, no results are displayed in the associated marker bar.
* @param markerColor the color of the marker
* @param icon the icon used to represent the cursor in the marker margin
* @param isPreferred true indicates higher priority than all non-preferred MarkerSets
*/
PointMarkerSet(MarkerManager navigationManager, String name, String desc, int priority,
boolean showMarkers, boolean showNavigation, boolean colorBackground, Color markerColor,
ImageIcon icon, boolean isPreferred) {
super(navigationManager, name, desc, priority, showMarkers, showNavigation, colorBackground,
markerColor, isPreferred);
if (icon == null) {
icon = ResourceManager.loadImage("images/warning.png");
}
icon = ResourceManager.getScaledIcon(icon, 16, 16, Image.SCALE_SMOOTH);
image = icon.getImage();
imageObserver = icon.getImageObserver();
if (markerColor != null) {
fillColor = getFillColor(markerColor);
}
}
public static BufferedImage getBufferedImage(ImageIcon icon) {
int width = 320;//icon.getIconWidth();
int height = 480;//icon.getIconHeight();
ImageObserver observer = icon.getImageObserver();
BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
Graphics gc = bufferedImage.createGraphics();
gc.drawImage(icon.getImage(), 0, 0, observer);
return bufferedImage;
}