mirror of
https://github.com/mitb-archive/filebot
synced 2025-03-09 13:59:49 -04:00
Fix text color (especially on Linux with dark GTK theme)
This commit is contained in:
parent
28edf9af8d
commit
5fe8383917
@ -11,7 +11,6 @@ import static net.filebot.util.ExceptionUtilities.*;
|
||||
import static net.filebot.util.FileUtilities.*;
|
||||
import static net.filebot.util.ui.SwingUI.*;
|
||||
|
||||
import java.awt.Font;
|
||||
import java.awt.Window;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.io.File;
|
||||
@ -32,7 +31,6 @@ import java.util.stream.Stream;
|
||||
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JLabel;
|
||||
|
||||
import net.filebot.HistorySpooler;
|
||||
import net.filebot.LicenseError;
|
||||
@ -253,11 +251,7 @@ class RenameAction extends AbstractAction {
|
||||
openURI(getPurchaseURL());
|
||||
}));
|
||||
|
||||
actionPopup.addSeparator();
|
||||
|
||||
JLabel label = new JLabel(message, ResourceManager.getIcon("status.error"), JLabel.CENTER);
|
||||
label.setFont(label.getFont().deriveFont(9f).deriveFont(Font.BOLD));
|
||||
actionPopup.addDescription(label);
|
||||
actionPopup.setStatus(message);
|
||||
|
||||
return actionPopup;
|
||||
}
|
||||
|
@ -38,7 +38,6 @@ import javax.swing.Icon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JList;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
@ -440,7 +439,7 @@ public class RenamePanel extends JComponent {
|
||||
private ActionPopup createFetchPopup() {
|
||||
ActionPopup actionPopup = new ActionPopup("Fetch & Match Data", ResourceManager.getIcon("action.fetch"));
|
||||
|
||||
actionPopup.addDescription(new JLabel("Episode Mode:"));
|
||||
actionPopup.addDescription("Episode Mode:");
|
||||
|
||||
// create actions for match popup episode list completion
|
||||
for (EpisodeListProvider db : WebServices.getEpisodeListProviders()) {
|
||||
@ -448,7 +447,7 @@ public class RenamePanel extends JComponent {
|
||||
}
|
||||
|
||||
actionPopup.addSeparator();
|
||||
actionPopup.addDescription(new JLabel("Movie Mode:"));
|
||||
actionPopup.addDescription("Movie Mode:");
|
||||
|
||||
// create action for movie name completion
|
||||
for (MovieIdentificationService it : WebServices.getMovieIdentificationServices()) {
|
||||
@ -456,17 +455,17 @@ public class RenamePanel extends JComponent {
|
||||
}
|
||||
|
||||
actionPopup.addSeparator();
|
||||
actionPopup.addDescription(new JLabel("Music Mode:"));
|
||||
actionPopup.addDescription("Music Mode:");
|
||||
for (MusicIdentificationService it : WebServices.getMusicIdentificationServices()) {
|
||||
actionPopup.add(new AutoCompleteAction(it.getName(), it.getIcon(), () -> new MusicMatcher(it)));
|
||||
}
|
||||
|
||||
actionPopup.addSeparator();
|
||||
actionPopup.addDescription(new JLabel("Smart Mode:"));
|
||||
actionPopup.addDescription("Smart Mode:");
|
||||
actionPopup.add(new AutoCompleteAction("Autodetect", ResourceManager.getIcon("action.auto"), AutoDetectMatcher::new));
|
||||
|
||||
actionPopup.addSeparator();
|
||||
actionPopup.addDescription(new JLabel("Options:"));
|
||||
actionPopup.addDescription("Options:");
|
||||
|
||||
actionPopup.add(newAction("Edit Format", ResourceManager.getIcon("action.format"), evt -> showFormatEditor(null)));
|
||||
|
||||
@ -539,13 +538,13 @@ public class RenamePanel extends JComponent {
|
||||
private ActionPopup createSettingsPopup() {
|
||||
ActionPopup actionPopup = new ActionPopup("Rename Options", ResourceManager.getIcon("action.settings"));
|
||||
|
||||
actionPopup.addDescription(new JLabel("Extension:"));
|
||||
actionPopup.addDescription("Extension:");
|
||||
actionPopup.add(new SetRenameMode(false, "Preserve", ResourceManager.getIcon("action.extension.preserve")));
|
||||
actionPopup.add(new SetRenameMode(true, "Override", ResourceManager.getIcon("action.extension.override")));
|
||||
|
||||
actionPopup.addSeparator();
|
||||
|
||||
actionPopup.addDescription(new JLabel("Action:"));
|
||||
actionPopup.addDescription("Action:");
|
||||
for (StandardRenameAction action : Preset.getSupportedActions()) {
|
||||
actionPopup.add(new SetRenameAction(action));
|
||||
}
|
||||
|
@ -1,12 +1,10 @@
|
||||
package net.filebot.util.ui;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.Action;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JPanel;
|
||||
@ -24,7 +22,11 @@ public class ActionPopup extends JPopupMenu {
|
||||
protected final JPanel actionPanel = new JPanel(new MigLayout("nogrid, insets 0, fill"));
|
||||
|
||||
public ActionPopup(String label, Icon icon) {
|
||||
// fix text color (especially on Linux with dark GTK theme)
|
||||
setForeground(new JMenuItem().getForeground());
|
||||
|
||||
headerLabel.setText(label);
|
||||
headerLabel.setForeground(getForeground());
|
||||
headerLabel.setIcon(icon);
|
||||
headerLabel.setIconTextGap(5);
|
||||
|
||||
@ -45,12 +47,14 @@ public class ActionPopup extends JPopupMenu {
|
||||
setLightWeightPopupEnabled(false);
|
||||
}
|
||||
|
||||
public void addDescription(JComponent component) {
|
||||
actionPanel.add(component, "gapx 4px 4px, growx, wrap 3px");
|
||||
protected JLabel createLabel(String text) {
|
||||
JLabel label = new JLabel(text);
|
||||
label.setForeground(getForeground());
|
||||
return label;
|
||||
}
|
||||
|
||||
public void addAction(JComponent component) {
|
||||
actionPanel.add(component, "gapx 12px 12px, growx, wrap");
|
||||
public void addDescription(String text) {
|
||||
actionPanel.add(createLabel(text), "gapx 4px 4px, growx, wrap 3px");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -72,19 +76,10 @@ public class ActionPopup extends JPopupMenu {
|
||||
// close popup when action is triggered
|
||||
link.addActionListener(closeListener);
|
||||
|
||||
addAction(link);
|
||||
actionPanel.add(link, "gapx 12px 12px, growx, wrap");
|
||||
return null;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
actionPanel.removeAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLabel(String label) {
|
||||
headerLabel.setText(label);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLabel() {
|
||||
return headerLabel.getText();
|
||||
@ -94,16 +89,6 @@ public class ActionPopup extends JPopupMenu {
|
||||
statusLabel.setText(string);
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return statusLabel.getText();
|
||||
}
|
||||
|
||||
private final ActionListener closeListener = new ActionListener() {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
setVisible(false);
|
||||
}
|
||||
};
|
||||
private final ActionListener closeListener = evt -> setVisible(false);
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user