可能会改变JButton的形状?

问题描述:

是否可以将JButton的形状从矩形变成圆形?可能会改变JButton的形状?

+0

可以检查了这一点:http://harryjoy.me/2011/08/21/different-button-shapes-in-swing/ – 2015-08-11 06:56:18

我认为这可能是你在找什么:

http://java-swing-tips.blogspot.com/2008/11/rounded-corner-jbutton.html

它有足够的代码示例,好像是你在找什么。希望这可以帮助!

+0

谢谢!它是有益的。 – Vikram 2012-07-31 14:44:00

+1

太棒了,很高兴我可以帮你。 – 2012-07-31 14:46:03

您也可以在按钮上使用图片。

+0

喜欢这个主意!谢谢! – Vikram 2012-07-31 14:42:30

+0

请您将标记为正确的答案 – Rish 2012-07-31 14:43:22

+0

对不起,Rish,我无法将您的答案标记为正确,因为它不是我正在寻找的确切东西,尽管我喜欢使用图像的概念。 – Vikram 2012-07-31 14:47:25

好吧,我发现在这方面多了一个有用的文章:使用setIcon,然后将JButton(按钮1)

http://www.dreamincode.net/forums/topic/207123-change-the-shape-of-jbutton/

Link Provided by Sean Cogan is all you need. and if you want it in short . 
set an image (rounded or any shape that you want your button should look alike) 

设置这些值 -

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