more about this new icon regime

This commit is contained in:
Ben Fry
2015-09-19 20:44:55 -04:00
parent 94ca5576f3
commit aad9b4bada
2 changed files with 9 additions and 7 deletions
@@ -62,7 +62,7 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib
if (upToDateIcon == null) {
upToDateIcon = Toolkit.getLibIconX("manager/up-to-date");
updateAvailableIcon = Toolkit.getLibIconX("manager/update-available");
incompatibleIcon = Toolkit.getLibIcon("manager/incompatible");
incompatibleIcon = Toolkit.getLibIconX("manager/incompatible");
}
}
@@ -295,14 +295,11 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib
Icon icon = null;
label.setFont(Toolkit.getSansFont(14, Font.PLAIN));
if (contribution.isInstalled()) {
//icon = Toolkit.getLibIcon("manager/up-to-date-" + ContributionManagerDialog.iconVer + "x.png");
icon = upToDateIcon;
if (contribListing.hasUpdates(contribution)) {
//icon = Toolkit.getLibIcon("manager/update-available-" + ContributionManagerDialog.iconVer + "x.png");
icon = updateAvailableIcon;
}
if (!contribution.isCompatible(Base.getRevision())) {
//icon = Toolkit.getLibIcon("manager/incompatible-" + ContributionManagerDialog.iconVer + "x.png");
icon = incompatibleIcon;
}
}
@@ -355,7 +352,6 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib
label.setOpaque(true);
} else {
if (contribution.isSpecial()) {
//label = new JLabel(Toolkit.getLibIcon("icons/foundation-16.png"));
label = new JLabel(Toolkit.getLibIconX("icons/foundation", 16));
} else {
label = new JLabel();
+8 -2
View File
@@ -483,11 +483,19 @@ public class Toolkit {
}
/**
* Get an image icon with hi-dpi support. Pulls 1x or 2x versions of the
* file depending on the display type, but sizes them based on 1x.
*/
static public ImageIcon getLibIconX(String base) {
return getLibIconX(base, 0);
}
/**
* Get an icon of the format base-NN.png where NN is the size, but if it's
* a hidpi display, get the NN*2 version automatically, sized at NN
*/
static public ImageIcon getLibIconX(String base, int size) {
final int scale = Toolkit.highResDisplay() ? 2 : 1;
String filename = (size == 0) ?
@@ -498,8 +506,6 @@ public class Toolkit {
// System.err.println("does not exist: " + file);
return null;
}
// ImageIcon icon = new ImageIcon(file.getAbsolutePath());
// ImageIcon outgoing = new ImageIcon(icon.getImage()) {
ImageIcon outgoing = new ImageIcon(file.getAbsolutePath()) {
@Override
public int getIconWidth() {