Propably the panel that contains the show/hide panels has FlowLayout manager. When components get invisible the container lays out from scratch the components again.
To get around with this you can use an AbsoluteLayout or make the panels invisible in a diferent way so you cannot see them but they are occuping space.