XCode 4.5

This commit is contained in:
Alexander Lobas
2012-10-10 18:43:47 +04:00
parent 1168b70686
commit 4b02405987
2 changed files with 7 additions and 1 deletions
@@ -173,7 +173,7 @@ public final class IconLoader {
}
@Nullable
private static Icon findIcon(URL url) {
public static Icon findIcon(URL url) {
if (url == null) return null;
Icon icon = ourIconsCache.get(url);
if (icon == null) {
@@ -32,6 +32,12 @@ public class SizedIcon implements Icon {
myImage = icon.getImage();
}
public SizedIcon(int maxWidth, int maxHeight, Image image) {
myWidth = Math.min(maxWidth, image.getWidth(null));
myHeight = Math.min(maxHeight, image.getHeight(null));
myImage = image;
}
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
g.drawImage(myImage, x, y, myWidth, myHeight, null);