Jframe f = new JFrame(); f.setDefaultCloreOperation(JFrame.EXIT_ON_CLOSE); f.setSize(200, 200); f.setLocationRelativeTo(null); f.setVisible(true);