title: Hide a button from Layout in Java Swing
body: <p>I am trying something very basic:
  I have a list of 5 buttons. They are in a FlowLayout and the general idea should be that once I click one it should disappear and the others should reorder themselves accordingly.</p>
  
  <p>Now, if I call setVisible(false) the button becomes invisible, but it still occupies it's space in the Layoutmanager. </p>
  
  <p>Is there any way to keep the Button in the JPanel while hiding it so it doesn't get picked up by Layout?</p>
  
  <p><strong>Update:</strong>: Thanks for all the answers, the problem with removing the buttons is that the order is important. The problem I was trying to solve was a find as you type szenario where a very long list of buttons gets filtered down to only the ones matching the characters entered so users can easily click them. Since users can delete characters from the search field ordering is important and buttons have to pop back in once they match again.</p>