没有实际JButton功能的Swing JButton的圆角 [英] Rounded corners for Swing JButton Swing without features of actual JButton

查看:191
本文介绍了没有实际JButton功能的Swing JButton的圆角的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经遍历了有关Swing外观和外观的Java文档.感觉,但对于如何修改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.

我应该怎么做?

推荐答案

您可以轻松地使用Java Swing主题,例如

You can easily use a Java Swing theme like Nimbus.

或查看堆栈溢出问题 按下一个按钮 .

Or check out Stack Overflow question Make a button round.

这篇关于没有实际JButton功能的Swing JButton的圆角的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆