开发者

Rounded borders on a JPanel

开发者 https://www.devze.com 2023-03-23 07:51 出处:网络
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));

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));

The prob开发者_如何学编程lem 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!

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


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


Your problem may be that the background panel is white and your foreground panel is PanelColor and since you are rounding out the edges you are seeing the white background behind your foreground panel.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号