在一个JPanel圆角边框 [英] Rounded borders on a JPanel

查看:1783
本文介绍了在一个JPanel圆角边框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里得到的是与被设置为这样的圆形边框的JPanel:

What I've got here is a JPanel with a rounded border that is set up as such:

panel.setBorder(new LineBorder(PanelColor, 5, true));

的问题是,在每一个角落的有2个对角线不透明线从外眼角到内拐角即边界的长度去。无论是背后的边框显示了通过。有什么办法来摆脱这些线条,使整个边框纯色?谢谢!

The problem is, in each of the corners there are 2 diagonal opaque lines going from the outer corner to the inner corner that is the length of the border. Whatever is behind the border shows through. Is there any way to get rid of these lines and make the entire border one solid color? Thanks!

我会附上图片,但我没有足够的代表这样做的:P

I'd attach a picture but I don't have enough rep to do so :P

推荐答案

也许<一个href=\"http://stackoverflow.com/questions/5751311/creating-custom-button-in-java/5755124#5755124\">here是一种作画RoundedLineBorder;请小心与漂亮的输出到GUI常量。

Maybe here is a way to paint RoundedLineBorder; please be careful with constants for nice output to the GUI.

这篇关于在一个JPanel圆角边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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