public CommandGui() {
        super("Commando");

        outputPanels = new CardLayout();
        errorPanels = new CardLayout();

        directory = System.getProperty("user.dir");
        File userDir = new File(directory);
        historyFile = new File(userDir, ".commandohistory");
        FileInputStream input = null;
        try {
            input = new FileInputStream(historyFile);
        } catch (FileNotFoundException e) {
            System.out.println("Cannot find history file: " + historyFile);
        }
        if (historyFile.exists()) {
            dataInput = new DataInputStream(input);
        }
        try {
            UIManager.setLookAndFeel(
                    UIManager.getSystemLookAndFeelClassName());
        } catch (Throwable e) {
        }
        container = getContentPane();
        createComponents();
        layoutComponents();
        addControlLogic();
	
        addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                FileOutputStream output = null;
                try {
                    output = new FileOutputStream(historyFile);
                } catch (FileNotFoundException ex) {
                    System.out.println("Cannot find historyFile: " + historyFile);
                }
                dataOutput = new DataOutputStream(output);
                writeHistory(dataOutput);
                try {
                    output.flush();
                } catch (IOException ioe) {
                    // NYI
                }
            }
        });
    }