5

我有一个带有 JButton、JTextField 和 JTable 的 JPanel,TAB 键按预期遍历这些组件,并在具有焦点的组件(或 JTable 的单元格)周围绘制了一个小黑框。如何更改黑盒焦点指示器的颜色?

4

1 回答 1

4

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);
于 2011-07-29T19:08:10.133 回答