Jskad won't allow you to exit by closing the last window anymore. Instead,

you get a dialog box saying to use File/Exit.
This commit is contained in:
dchandler 2003-07-04 00:21:07 +00:00
parent 6c286573ba
commit 7500b4e06b

View file

@ -209,9 +209,16 @@ public class Jskad extends JPanel implements DocumentListener {
JMenuItem closeItem = new JMenuItem("Close"); JMenuItem closeItem = new JMenuItem("Close");
closeItem.addActionListener(new ThdlActionListener() { closeItem.addActionListener(new ThdlActionListener() {
public void theRealActionPerformed(ActionEvent e) { public void theRealActionPerformed(ActionEvent e) {
if (!hasChanged || hasChanged && checkSave(JOptionPane.YES_NO_CANCEL_OPTION)) { if (numberOfTibsRTFOpen == 1) {
Jskad.this.realCloseAction(true); JOptionPane.showMessageDialog(Jskad.this,
} "You cannot close the last Jskad window.\nUse File/Exit if you intend to exit.",
"Cannot close last Jskad window",
JOptionPane.ERROR_MESSAGE);
} else {
if (!hasChanged || hasChanged && checkSave(JOptionPane.YES_NO_CANCEL_OPTION)) {
Jskad.this.realCloseAction(true);
}
}
} }
}); });
fileMenu.add(closeItem); fileMenu.add(closeItem);