Fix subtitle source icon lookup

This commit is contained in:
Reinhard Pointner 2018-03-06 12:47:11 +07:00
parent a6df6e02a7
commit 754a473316
2 changed files with 7 additions and 8 deletions

View File

@ -27,6 +27,10 @@ public final class ResourceManager {
} }
private static Icon getIcon(List<String> icons) { private static Icon getIcon(List<String> icons) {
if (icons.isEmpty()) {
return null;
}
return cache.computeIfAbsent(icons.get(0), i -> { return cache.computeIfAbsent(icons.get(0), i -> {
// load image // load image
URL[] resource = getMultiResolutionImageResource(i); URL[] resource = getMultiResolutionImageResource(i);
@ -35,11 +39,7 @@ public final class ResourceManager {
} }
// try next image // try next image
if (icons.size() > 0) { return getIcon(icons.subList(1, icons.size()));
return getIcon(icons.subList(1, icons.size()));
}
return null;
}); });
} }

View File

@ -37,7 +37,6 @@ import java.util.logging.Level;
import javax.swing.AbstractAction; import javax.swing.AbstractAction;
import javax.swing.Action; import javax.swing.Action;
import javax.swing.BorderFactory;
import javax.swing.DefaultCellEditor; import javax.swing.DefaultCellEditor;
import javax.swing.DefaultComboBoxModel; import javax.swing.DefaultComboBoxModel;
import javax.swing.DefaultListCellRenderer; import javax.swing.DefaultListCellRenderer;
@ -169,8 +168,8 @@ class SubtitleAutoMatchDialog extends JDialog {
} }
protected void addSubtitleService(final SubtitleServiceBean service, final JPanel servicePanel) { protected void addSubtitleService(final SubtitleServiceBean service, final JPanel servicePanel) {
final LinkButton component = new LinkButton(service.getDescription(), null, ResourceManager.getIcon("database"), service.getLink()); LinkButton component = new LinkButton(service.getDescription(), null, ResourceManager.getIcon("database.go"), service.getLink());
component.setBorder(BorderFactory.createEmptyBorder()); component.setBorder(createEmptyBorder());
component.setVisible(false); component.setVisible(false);
service.addPropertyChangeListener(evt -> { service.addPropertyChangeListener(evt -> {