#2509 Tuner frequency control highlight color adapts to color theme (#2510)

Co-authored-by: denny <dennis.sheirer@gmail.com>
This commit is contained in:
Denny Sheirer
2026-10-20 03:46:53 -04:00
committed by GitHub
parent c0a96f94fb
commit b0428a1d8b

View File

@@ -45,6 +45,7 @@ import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.UIManager;
/**
* Custom frequency controller for displaying or editing frequency values in MHz.
@@ -556,19 +557,20 @@ public class JFrequencyControl extends JPanel implements ISourceEventProcessor
@Override
public void mouseEntered(MouseEvent e)
{
Digit.this.setBackground(mHighlightColor);
repaint();
}
Color bg = UIManager.getColor("TextField.selectionBackground");
Color fg = UIManager.getColor("TextField.selectionForeground");
Digit.this.setBackground(bg != null ? bg : Color.YELLOW);
Digit.this.setForeground(fg != null ? fg : Color.BLACK);
repaint(); }
@Override
public void mouseExited(MouseEvent e)
{
//Restore the LAF text-field background rather than hardcoding white so the digit
//cells match the active theme when the mouse leaves.
Color textBg = javax.swing.UIManager.getColor("TextField.background");
Digit.this.setBackground(textBg != null ? textBg : Color.WHITE);
repaint();
}
Color bg = UIManager.getColor("TextField.background");
Color fg = UIManager.getColor("TextField.foreground");
Digit.this.setBackground(bg != null ? bg : Color.WHITE);
Digit.this.setForeground(fg != null ? fg : Color.BLACK);
repaint(); }
@Override
public void mouseWheelMoved(MouseWheelEvent e)