diff --git a/source/net/sourceforge/filebot/ui/panel/subtitle/LanguageComboBoxCellRenderer.java b/source/net/sourceforge/filebot/ui/panel/subtitle/LanguageComboBoxCellRenderer.java index 08cc0b66..7e080204 100644 --- a/source/net/sourceforge/filebot/ui/panel/subtitle/LanguageComboBoxCellRenderer.java +++ b/source/net/sourceforge/filebot/ui/panel/subtitle/LanguageComboBoxCellRenderer.java @@ -5,8 +5,9 @@ package net.sourceforge.filebot.ui.panel.subtitle; import java.awt.Color; import java.awt.Component; -import javax.swing.DefaultListCellRenderer; +import javax.swing.JLabel; import javax.swing.JList; +import javax.swing.ListCellRenderer; import javax.swing.border.Border; import javax.swing.border.CompoundBorder; import javax.swing.border.EmptyBorder; @@ -14,37 +15,48 @@ import javax.swing.border.EmptyBorder; import net.sourceforge.filebot.ResourceManager; -class LanguageComboBoxCellRenderer extends DefaultListCellRenderer { +class LanguageComboBoxCellRenderer implements ListCellRenderer { - private final Border padding = new EmptyBorder(2, 2, 2, 2); + private final Border padding = new EmptyBorder(2, 4, 2, 4); private final Border favoritePadding = new EmptyBorder(0, 6, 0, 6); + private final ListCellRenderer base; + + + + public LanguageComboBoxCellRenderer(final ListCellRenderer base) { + this.base = base; + } + + + + @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { - super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); + JLabel c = (JLabel)base.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); Language language = (Language) value; - setText(language.getName()); - setIcon(ResourceManager.getFlagIcon(language.getCode())); + c.setText(language.getName()); + c.setIcon(ResourceManager.getFlagIcon(language.getCode())); // default padding - setBorder(padding); + c.setBorder(padding); LanguageComboBoxModel model = (LanguageComboBoxModel) list.getModel(); if ((index > 0 && index <= model.favorites().size())) { // add favorite padding - setBorder(new CompoundBorder(favoritePadding, getBorder())); + c.setBorder(new CompoundBorder(favoritePadding, c.getBorder())); } if (index == 0 || index == model.favorites().size()) { // add separator border - setBorder(new CompoundBorder(new DashedSeparator(10, 4, Color.lightGray, list.getBackground()), getBorder())); + c.setBorder(new CompoundBorder(new DashedSeparator(10, 4, Color.lightGray, list.getBackground()), c.getBorder())); } - return this; + return c; } } diff --git a/source/net/sourceforge/filebot/ui/panel/subtitle/SubtitlePanel.java b/source/net/sourceforge/filebot/ui/panel/subtitle/SubtitlePanel.java index 7d11d0d0..f07370d7 100644 --- a/source/net/sourceforge/filebot/ui/panel/subtitle/SubtitlePanel.java +++ b/source/net/sourceforge/filebot/ui/panel/subtitle/SubtitlePanel.java @@ -2,8 +2,9 @@ package net.sourceforge.filebot.ui.panel.subtitle; -import static net.sourceforge.filebot.Settings.*; -import static net.sourceforge.filebot.ui.panel.subtitle.LanguageComboBoxModel.*; +import static net.sourceforge.filebot.Settings.getApplicationName; +import static net.sourceforge.filebot.Settings.getApplicationVersion; +import static net.sourceforge.filebot.ui.panel.subtitle.LanguageComboBoxModel.ALL_LANGUAGES; import java.awt.event.ItemEvent; import java.net.URI; @@ -43,8 +44,8 @@ public class SubtitlePanel extends AbstractSearchPanel