From 7500b4e06bb670902c8809810011de6897815d1c Mon Sep 17 00:00:00 2001 From: dchandler Date: Fri, 4 Jul 2003 00:21:07 +0000 Subject: [PATCH] Jskad won't allow you to exit by closing the last window anymore. Instead, you get a dialog box saying to use File/Exit. --- source/org/thdl/tib/input/Jskad.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/source/org/thdl/tib/input/Jskad.java b/source/org/thdl/tib/input/Jskad.java index 5401af2..b9bb7eb 100644 --- a/source/org/thdl/tib/input/Jskad.java +++ b/source/org/thdl/tib/input/Jskad.java @@ -209,9 +209,16 @@ public class Jskad extends JPanel implements DocumentListener { JMenuItem closeItem = new JMenuItem("Close"); closeItem.addActionListener(new ThdlActionListener() { public void theRealActionPerformed(ActionEvent e) { - if (!hasChanged || hasChanged && checkSave(JOptionPane.YES_NO_CANCEL_OPTION)) { - Jskad.this.realCloseAction(true); - } + if (numberOfTibsRTFOpen == 1) { + 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);