Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java rounded corner bug

Tags:

java

border

swing

I'm working on a GUI in Java, and I'm trying to give rounded corners to my borders.

JPanel recentProjectsPanel = new JPanel();
    recentProjectsPanel.setLayout(new BorderLayout());
    recentProjectsPanel.setBackground(Color.red);
    recentProjectsPanel.setBorder(new LineBorder(Color.green, 15, true));

This is the output I get (don't mind the colors):

Failing Border GUI

Why do I get these red stripes in the corners? Any way to fix this?

like image 441
jeerome48 Avatar asked May 04 '12 10:05

jeerome48


2 Answers

You might use a variant of the TextBubbleBorder instead.

like image 141
Andrew Thompson Avatar answered Nov 15 '22 11:11

Andrew Thompson


Have a look at this

Java - rounded corner panel with compositing in paintComponent

this has much information regarding same.

like image 2
Rahul Borkar Avatar answered Nov 15 '22 10:11

Rahul Borkar