windowlistener « Dialog « Java Swing Q&A





1. JDialog with WindowStateListener    stackoverflow.com

I am trying to catch an event of user clicking on and "X" button of a JDialog and only close if a user confirms. So here is skeleton of what I ...

2. WindowListener not working JDialog    coderanch.com

package main; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.swing.JDialog; import javax.swing.JOptionPane; import javax.swing.WindowConstants; public class ArchiveSelecterDialog extends JDialog { private final Object[] options = { " 1 ", " 2 " }; private MusiqueFrame frame; private int n; public ArchiveSelecterDialog(MusiqueFrame fr, final DocumentScrollPane pane, final boolean replace, final String archive1, final String archive2) { super(fr); this.frame = fr; this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); this.addWindowListener(new WindowAdapter() { ...