Here you can find the source of getManagedImage(Component source, String file, float tint, Color solid)
public static Image getManagedImage(Component source, String file, float tint, Color solid)
//package com.java2s; //License from project: Artistic License import java.awt.*; import java.io.*; public class Main { /** gets a managed image with the specified alpha tinting and all that jazz */ public static Image getManagedImage(Component source, String file, float tint, Color solid) { if (!(new File(file)).exists()) { return null; }//from www .j a v a 2s. c o m Image imageData = new javax.swing.ImageIcon(file).getImage(); if (tint > 0) { Image imageDataTinted = source.createImage(imageData.getWidth(null), imageData.getHeight(null)); Graphics2D g2 = (Graphics2D) imageDataTinted.getGraphics(); Composite oc = g2.getComposite(); g2.drawImage(imageData, 0, 0, null); AlphaComposite ac = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, tint); g2.setComposite(ac); g2.setColor(solid); g2.fillRect(0, 0, imageDataTinted.getWidth(null), imageDataTinted.getHeight(null)); g2.dispose(); return imageDataTinted; } return imageData; } }