更改Java Swing组件焦点指示器的颜色 [英] Change the color of the Java Swing Component Focus indicator
本文介绍了更改Java Swing组件焦点指示器的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
解决方案
选择外观是在每个组件的UI委托的控制下,在 如何设置外观 。
作为一个具体的例子,在某些L& Fs上,当程序启动时,你可以重写默认值:
pre code> UIManager.put(Button.focus,Color.red);
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);
这篇关于更改Java Swing组件焦点指示器的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文