Either


frame.dispose();

or


frame.setVisible(false);