[英]Java Swing - Show border of controls when clicking Tab key only
我已经在大多数程序中注意到了这种行为:
但是在Java Swing应用程序中,单击控件以及单击“ Tab”键时都会出现边框,或者我可以永远隐藏该边框。
有没有办法使用上述默认行为(仅在单击“ Tab”键时显示边框)?
公共无效setFocusPainted(boolean b)?
实际上,这取决于L&F。 例如代码
protected void paintFocus(Graphics g, Rectangle textRect, Dimension d){
g.setColor(getFocusColor());
BasicGraphicsUtils.drawDashedRect(g, textRect.x, textRect.y, textRect.width, textRect.height);
}
从WindowsRadioButtonUI(复选框UI扩展了单选按钮UI)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.