boolean checkClose() {
        if (!modified) {
            return true;
        } else {
            Object[] options = {"Save", "Discard", "Cancel"};
            int n = JOptionPane.showOptionDialog(console, "File " + file + " is modified.",
                    "Warning", JOptionPane.YES_NO_CANCEL_OPTION,
                    JOptionPane.QUESTION_MESSAGE, null, options, options[2]);
            if (n == 0) {
                save(false);
                return true;
            }
            if (n == 2) {
                return false;
            }
        }
        return true;
    }