可能会改变JButton的形状?
答
我认为这可能是你在找什么:
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
答
好吧,我发现在这方面多了一个有用的文章:使用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);
可以检查了这一点:http://harryjoy.me/2011/08/21/different-button-shapes-in-swing/ – 2015-08-11 06:56:18