Doug
Doug

Reputation: 47

Rounded borders on a 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));

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!

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

Upvotes: 3

Views: 18064

Answers (2)

mKorbel
mKorbel

Reputation: 109823

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

Upvotes: 5

Grammin
Grammin

Reputation: 12215

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.

Upvotes: 0

Related Questions