XCode 4.5

This commit is contained in:
Alexander Lobas
2012-10-10 18:56:30 +04:00
parent 4b02405987
commit 0407bc043c
2 changed files with 7 additions and 7 deletions
@@ -174,7 +174,9 @@ public final class IconLoader {
@Nullable
public static Icon findIcon(URL url) {
if (url == null) return null;
if (url == null) {
return null;
}
Icon icon = ourIconsCache.get(url);
if (icon == null) {
icon = new CachedImageIcon(url);
@@ -26,18 +26,16 @@ public class SizedIcon implements Icon {
private final int myHeight;
private final Image myImage;
public SizedIcon(int maxWidth, int maxHeight, ImageIcon icon) {
myWidth = Math.min(maxWidth, icon.getIconWidth());
myHeight = Math.min(maxHeight, icon.getIconHeight());
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;
}
public SizedIcon(int maxWidth, int maxHeight, ImageIcon icon) {
this(maxWidth, maxHeight, icon.getImage());
}
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
g.drawImage(myImage, x, y, myWidth, myHeight, null);