Jframe exit oon close java20
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
Fancy Flatworm
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setVisible(false); //you can't see me!
dispose(); //Destroy the JFrame object