For window closing you canuse:<br><br>button1.addActionListener(new java.awt.event.ActionListener() {<br>public voidactionPerformed(ActionEvent e) {<br> dispose();<br> }<br>});