// Close the window when the close box is clicked
  public void windowClosing(java.awt.event.WindowEvent e) {
    // check for various types of dirty - first table data not written back
    if (cvModel.decoderDirty() || variableModel.decoderDirty()) {
      if (JOptionPane.showConfirmDialog(
              null,
              "Some changes have not been written to the decoder. They will be lost. Close window?",
              "choose one",
              JOptionPane.OK_CANCEL_OPTION)
          == JOptionPane.CANCEL_OPTION) {
        return;
      }
    }
    if (variableModel.fileDirty()) {
      if (JOptionPane.showConfirmDialog(
              null,
              "Some changes have not been written to a configuration file. Close window?",
              "choose one",
              JOptionPane.OK_CANCEL_OPTION)
          == JOptionPane.CANCEL_OPTION) {
        return;
      }
    }

    modePane.dispose();
    // OK, close
    super.windowClosing(e);
  }