Theme-aware icons for the main window menu bar and Playlist Editor tab (#2493)

The main window's font-glyph icons were rendered with IconFontSwing.buildIcon,
which bakes a fixed colour into the image (black by default, DARK_GRAY for the
Playlist Editor tab), so the Screen Capture camera, the Playlist Editor tab icon
and the View menu icons ignored the selected theme and were nearly invisible on
dark themes.

Adds ThemedFontIcon, which resolves its colour from UIManager at paint time
(Label.foreground, MenuItem.selectionForeground while a menu item is armed,
Label.disabledForeground when disabled) and re-renders only when the colour
changes, so icons follow theme switches without a restart.


Claude-Session: https://claude.ai/code/session_01TDsxnQntujmycg3aJyRsuN

Co-authored-by: Dennis Sheirer <dennis.sheirer@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Denny Sheirer
2026-10-12 06:05:18 -04:00
committed by GitHub
parent b37ed51d07
commit 0460f2b77b
5 changed files with 195 additions and 17 deletions

View File

@@ -32,10 +32,9 @@ import io.github.dsheirer.preference.UserPreferences;
import io.github.dsheirer.settings.SettingsManager;
import io.github.dsheirer.source.tuner.manager.TunerManager;
import io.github.dsheirer.source.tuner.ui.TunerViewPanel;
import java.awt.Color;
import java.awt.Dimension;
import jiconfont.icons.font_awesome.FontAwesome;
import jiconfont.swing.IconFontSwing;
import io.github.dsheirer.gui.theme.ThemedFontIcon;
import net.miginfocom.swing.MigLayout;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -104,7 +103,7 @@ public class ControllerPanel extends JPanel
mTabbedPane.addTab("Map", mMapPanel);
mTabbedPane.addTab("Tuners", mTunerManagerPanel);
Icon playIcon = IconFontSwing.buildIcon(FontAwesome.PLAY_CIRCLE_O, 20, Color.DARK_GRAY);
Icon playIcon = new ThemedFontIcon(FontAwesome.PLAY_CIRCLE_O, 20);
mTabbedPane.addTab("Playlist Editor", playIcon, new JLabel("Show Playlist Manager"));
mSettingsTabIndex = mTabbedPane.getTabCount() - 1;