【问题标题】:Possible to change the shape of JButton?可以改变JButton的形状吗?
【发布时间】:2012-07-31 14:32:05
【问题描述】:

是否可以将 JButton 的形状从矩形更改为圆形?

【问题讨论】:

标签: java swing jbutton


【解决方案1】:

Sean Cogan 提供的链接就是您所需要的。如果您想要简而言之,请设置一个图像(圆形或任何您希望按钮看起来相似的形状) 使用setIcon,然后在 JButton (button1) 上设置这些值 -

button1.setContentAreaFilled(false);
button1.setFocusPainted(false);
button1.setBorderPainted(false);

【讨论】:

    【解决方案2】:

    您还可以在按钮上使用图像。

    【讨论】:

    • 抱歉,我无法将您的答案标记为正确,因为这不是我正在寻找的确切内容,尽管我喜欢使用图像的概念。
    猜你喜欢
    • 2021-06-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-02-02
    • 1970-01-01
    • 2016-07-04
    • 2013-01-13
    相关资源
    最近更新 更多