title: Clearing JPanel
body: <p>I am making a program in which there is a square that changes its x and y positions when a key is pressed. The square moves but the the old square is still there. How do I remove/clear everything from a panel before I repaint it? Calling <code>removeAll</code> had no effect.</p>