Java Code Examples for javax.swing.ImageIcon#getImageObserver()

The following examples show how to use javax.swing.ImageIcon#getImageObserver() . 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: PointMarkerSet.java    From ghidra with Apache License 2.0 6 votes vote down vote up
/**
 * @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);
	}
}
 
Example 2
Source File: SetCheckPoint2.java    From AndroidRobot with Apache License 2.0 5 votes vote down vote up
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;
}