SetVisible(false) changes the layout of my components within my Panel
How do I make the subpanels within my main panel stay where they are when I set one of the subpanels to be invisible? What I have looks like: [ (Panel1) (Panel2) (Panel3) (Panel4) ] When I do panel3.setVisible(false) it then looks like: [ (Panel1) (Panel2) (Panel4) ] I would like it to look like: [ (Panel1) (Panel2) (Panel4) ] I am using the GridBagLayout and my mainPanel declaration looks like: final JPanel panel = new JPanel(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); and I add an new panel like: final JTextField valueTextField = new JTextField(); valueTextField