开发者

Java focus question

开发者 https://www.devze.com 2022-12-25 01:48 出处:网络
This may be a silly question I don\'t know. Is there a way to remove the highlighter to represent focus in a Java GUI?

This may be a silly question I don't know.

Is there a way to remove the highlighter to represent focus in a Java GUI?

For example when you cli开发者_Go百科ck on a button the text will have a slight rectangle around the text.

Thank you


I believe you want to remove the set focusable attribute from your items

using setFocusable(false)

http://java.sun.com/docs/books/tutorial/uiswing/misc/focus.html


That feature is there for a reason because it gives user feedback about which component currently has focus. But if you really must turn it off then you can use:

button.setFocusPainted( false );


As far as I knew one of the selling points of swing when it first appeared was that any GUI element could be completely customised. This might help you out: Custom Swing Controls

0

精彩评论

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