/** * Repacks the window each time it is displayed to adjust size to fit wording and buttons. * * @param e event. */ protected void processWindowEvent(WindowEvent e) { super.processWindowEvent(e); if (e.getID() == WindowEvent.WINDOW_OPENED) pack(); }
public void windowClosing(WindowEvent evt) { JFrame frame = (JFrame) evt.getSource(); frame.setVisible(false); frame.dispose(); }