use of com.android.tools.idea.ui.ImageComponent in project android by JetBrains.
the class PreviewIconsPanel method initializeIconComponents.
private void initializeIconComponents(@NotNull Collection<Density> densities) {
// Sort the densities, so that we always line up icons from highest to lowest densities.
Ordering<Density> densityOrdering = new Ordering<Density>() {
@Override
public int compare(Density left, Density right) {
// The lower the enum index, the higher the density
return Ints.compare(left.ordinal(), right.ordinal());
}
};
densities = densityOrdering.immutableSortedCopy(densities);
for (Density density : densities) {
JPanel iconPanel = new JPanel(new VerticalFlowLayout(false, false));
iconPanel.setBackground(myTheme.getMainColor());
iconPanel.setOpaque(myTheme != Theme.TRANSPARENT);
JBLabel title = new JBLabel(density.getResourceValue());
title.setForeground(myTheme.getAltColor());
iconPanel.add(title);
ImageComponent iconImage = new ImageComponent(null);
iconImage.setBorder(new LineBorder(myTheme.getAltColor()));
iconImage.setOpaque(false);
iconPanel.add(iconImage);
GridBagConstraints c = new GridBagConstraints();
c.anchor = GridBagConstraints.PAGE_START;
myIconsPanel.add(iconPanel, c);
myIconImages.put(density, iconImage);
}
}
Aggregations