I have a JPanel with a JButton, JTextField and a JTable, and the TAB key traverses these components as expected with a little black box drawn around the component (or cell in case of the JTable) that has focus. How can I change the color of the black-box focus indicator?
The selection appearance is under the control of each component's UI delegate, discussed in How to Set the Look and Feel.
As a concrete example, on certain L&Fs, you can override the default value when your program starts up:
UIManager.put("Button.focus", Color.red);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With