I have noticed this behavior in most programs :
- When clicking any control in a window no border appears around this control, like here :
- When clicking 'Tab' key a border appears around the control, then i can navigate through all controls, like here :
But in Java Swing applications the border appears when click on the control and also when clicking the 'Tab' key, or i can hide tha开发者_运维百科t border forever.
Is there a way to use the default behavior mentioned above(Show the border when clicking 'Tab' key only) ?
public void setFocusPainted(boolean b) ?
Actually it depends on L&F. E.g. the code
protected void paintFocus(Graphics g, Rectangle textRect, Dimension d){
g.setColor(getFocusColor());
BasicGraphicsUtils.drawDashedRect(g, textRect.x, textRect.y, textRect.width, textRect.height);
}
from WindowsRadioButtonUI (checkbox UI extends radiobutton UI)
精彩评论