FileDocCategorySizeDatePackage
IconLoader.javaAPI DocAndroid 1.5 API1538Wed May 06 22:41:10 BST 2009com.android.hierarchyviewer.ui.util

IconLoader

public class IconLoader extends Object

Fields Summary
Constructors Summary
Methods Summary
private static java.awt.GraphicsConfigurationgetGraphicsConfiguration()

        GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment();
        return environment.getDefaultScreenDevice().getDefaultConfiguration();
    
private static booleanisHeadless()

        return GraphicsEnvironment.isHeadless();
    
public static javax.swing.Iconload(java.lang.Class klass, java.lang.String path)

        try {
            return new ImageIcon(ImageIO.read(klass.getResourceAsStream(path)));
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    
public static java.awt.image.BufferedImagetoCompatibleImage(java.awt.image.BufferedImage image)

        if (isHeadless()) {
            return image;
        }

        if (image.getColorModel().equals(
                getGraphicsConfiguration().getColorModel())) {
            return image;
        }

        BufferedImage compatibleImage = getGraphicsConfiguration().createCompatibleImage(
                    image.getWidth(), image.getHeight(), image.getTransparency());
        Graphics g = compatibleImage.getGraphics();
        g.drawImage(image, 0, 0, null);
        g.dispose();

        return compatibleImage;