Question: Here is my problem

![enter image description here](https://i.stack.imgur.com/wQrDP.jpg)

How can I get rid of the gap from the inner rectangle box (it is actually the border of the middle JPanel)?

The outter rectangle is a extends JCompoment. Inside it contains three `JPanel`s. Each of them use GridLayout. I even try to setHgap to a negative value in the big rectangle, but it doesn't change anything.

Edit: Sorry the question is not clear. I do want the border, but I don't want the gap between the inner border and outer border. If there is no gap in between, the whole rectangle will represent a class diagram class.

Answer: 
> 
> it is actually the border of the middle JPanel
> 
> 
> 

If it is the border, remove that (`setBorder(null)`).
I think if you try setBorderPainted(false) it may get rid of the unwanted border.