fixed colors in settings

This commit is contained in:
rdavidek 2026-01-21 23:27:48 +01:00
parent a4afc103ad
commit c790303438

View File

@ -268,6 +268,11 @@ public class SettingsDialog extends JDialog {
Color selColor = config != null ? config.getSelectionColor() : null; Color selColor = config != null ? config.getSelectionColor() : null;
for (Component c : container.getComponents()) { for (Component c : container.getComponents()) {
// Skip specialized buttons that manage their own background colors
if (c instanceof JComponent && Boolean.TRUE.equals(((JComponent) c).getClientProperty("isColorButton"))) {
continue;
}
if (c instanceof JPanel || c instanceof JScrollPane || c instanceof JViewport || c instanceof JTabbedPane || c instanceof JButton || c instanceof JSplitPane || c instanceof JList) { if (c instanceof JPanel || c instanceof JScrollPane || c instanceof JViewport || c instanceof JTabbedPane || c instanceof JButton || c instanceof JSplitPane || c instanceof JList) {
c.setBackground(bg); c.setBackground(bg);
} }
@ -329,6 +334,7 @@ public class SettingsDialog extends JDialog {
appearanceBgBtn = createColorButton(config.getBackgroundColor(), "Choose background color", c -> { appearanceBgBtn = createColorButton(config.getBackgroundColor(), "Choose background color", c -> {
config.setBackgroundColor(c); config.setBackgroundColor(c);
applyAppearance();
if (onChange != null) onChange.run(); if (onChange != null) onChange.run();
}); });
gbc.gridx = 1; gbc.gridy = row++; gbc.weightx = 1.0; gbc.gridx = 1; gbc.gridy = row++; gbc.weightx = 1.0;
@ -341,6 +347,7 @@ public class SettingsDialog extends JDialog {
appearanceSelBtn = createColorButton(config.getSelectionColor() != null ? config.getSelectionColor() : new Color(184, 207, 229), appearanceSelBtn = createColorButton(config.getSelectionColor() != null ? config.getSelectionColor() : new Color(184, 207, 229),
"Choose selection color", c -> { "Choose selection color", c -> {
config.setSelectionColor(c); config.setSelectionColor(c);
applyAppearance();
if (onChange != null) onChange.run(); if (onChange != null) onChange.run();
}); });
gbc.gridx = 1; gbc.gridy = row++; gbc.weightx = 1.0; gbc.gridx = 1; gbc.gridy = row++; gbc.weightx = 1.0;
@ -390,6 +397,7 @@ public class SettingsDialog extends JDialog {
} }
} }
}; };
btn.putClientProperty("isColorButton", Boolean.TRUE);
btn.setOpaque(true); btn.setOpaque(true);
btn.setContentAreaFilled(false); btn.setContentAreaFilled(false);
btn.setFocusPainted(false); btn.setFocusPainted(false);