You are better off not adding components after a container (eg your JFrame) is realized (eg is visible). In other words, move you setVisible(true) call to after the component additions and layout...