开发者

Change the color of the Java Swing Component Focus indicator

开发者_如何转开发

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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜