不带凸起部分的 Java Swing Jbutton 组
我想知道如何显示一组 JButton,使其看起来像没有凸起部分的光滑面板。
谢谢
I wanted to know how to display a group of JButtons to look like smooth panel without raised portion.
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可能还想看看其他一些控制绘画的“setXXX”方法。
You may want to look at some of the other "setXXX" method that control painting as well.
我经常只使用标准 JLabels 并添加 mouseListener 以使它们可点击。或者,如果您想对按钮的呈现进行真正的细粒度控制,您可以更高级并创建自己的 ButtonUI 类。
I've often just used standard JLabels and added mouseListeners to make them clickable. Alternatively, you could get more advanced and create your own ButtonUI class if you want to really fine-grained control over the rendering of the buttons.
如果您希望按钮排成一行,可以将它们放在 JToolBar 中并将 Rollover 设置为 true。这将使平面按钮在鼠标悬停时看起来凸起。
If you want the buttons to be in a row, you can put them in a JToolBar and set Rollover to true. This will make flat buttons that, with mouse over, look raised.