不带凸起部分的 Java Swing Jbutton 组

发布于 2024-08-14 19:20:36 字数 55 浏览 3 评论 0原文

我想知道如何显示一组 JButton,使其看起来像没有凸起部分的光滑面板。

谢谢

I wanted to know how to display a group of JButtons to look like smooth panel without raised portion.

thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

吐个泡泡 2024-08-21 19:20:36
button.setBorder(null);

您可能还想看看其他一些控制绘画的“setXXX”方法。

button.setBorder(null);

You may want to look at some of the other "setXXX" method that control painting as well.

俏︾媚 2024-08-21 19:20:36

我经常只使用标准 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.

陌上青苔 2024-08-21 19:20:36

如果您希望按钮排成一行,可以将它们放在 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文