【发布时间】:2011-10-14 21:04:54
【问题描述】:
我有一个想要与边框一起使用的图标按钮。默认边框看起来太粗了。
创建与当前外观颜色相同的边框最简单的方法是什么?
Button myButton = createMyIconButton();
...
public Button createMyIconButton()
{
...
setBorder(BorderFactory.createLineBorder(???, 1));
}
【问题讨论】:
-
这个边框有问题吗
-
@mKorbel:我不明白。
-
如果 1) 某些本机操作系统上的某些 L&F 不返回任何边框或 LineBorder 2) 你的想法将对 L&F 和本机操作系统敏感,3) 你没有写我想要在 Window OS 上从 Nimbus 或 Metal L&F 中提取边框,4) 可能您需要覆盖 download.oracle.com/javase/6/docs/api/javax/swing/plaf/basic/…,但对于所有可能的 L&F 和 Platform,5) MetalButtonUI 和 Windows OS stackoverflow.com/questions/5751311/… 的最简单方法,注意,未完成,一些绘画效果来自 UI 和 ButtonModel
标签: java swing user-interface look-and-feel