没有实际JButton功能的Swing JButton的圆角 [英] Rounded corners for Swing JButton Swing without features of actual JButton
问题描述
我已经遍历了JButtons
的默认外观,我找不到很多东西.
I have gone through the code on Java documentation for Swing look and feel, but I could not find much about how to modify the default look of JButtons
.
我想在Swing中使用rounded/curved corners
来表示JButtons
.
I want to have rounded/curved corners
for JButtons
in Swing.
有没有办法做到这一点? 我应该使用什么功能和值?
Is there a way to achieve this? What functions and values should I use?
我使用了以下语句:
generateButton.setBorder(new RoundedBorder(20));
我在Stack Overflow问题 Rounded Swing JButton中找到了RoundedBorder的代码 :>
The code for RoundedBorder I found in Stack Overflow question Rounded Swing JButton using Java:
我在原始按钮周围确实得到了一个黑色的圆形边框.我的按钮有橙色背景.但是,它不会删除圆角之外的橙色区域.另外,我也不想使用黑色边框.
I do get a black rounded border outline around the original button. MY button has orange background. But it doesn't remove the orange area outside the rounded corners. Also I do not want the black border.
我应该怎么做?
推荐答案
You can easily use a Java Swing theme like Nimbus.
或查看堆栈溢出问题 按下一个按钮 .
Or check out Stack Overflow question Make a button round.
这篇关于没有实际JButton功能的Swing JButton的圆角的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!