addRecentLoad(rom.getPath()); refreshRecentLoads();
    public void actionPerformed(ActionEvent ae)    {        if (ae.getActionCommand().equalsIgnoreCase("load"))        {            loadRom(null);        }        else if (ae.getActionCommand().equalsIgnoreCase("save"))        {            rom.saveRom();            doBackup();        }        else if (ae.getActionCommand().equalsIgnoreCase("saveAs"))        {            rom.saveRomAs();            doBackup();        }        else if (ae.getActionCommand().equalsIgnoreCase("closeRom"))        {            closeRom();        }        else if (ae.getActionCommand().startsWith("revert-"))        {            this.restoreFromBackup(ae.getActionCommand().substring(7));        }        else if (ae.getActionCommand().startsWith("recentLoad"))        {            loadRom(new File(recentLoadsItems[Integer.parseInt(ae                .getActionCommand().substring(10))].getText().substring(2)));        }        else if (ae.getActionCommand().equalsIgnoreCase("exit"))        {            this.exit();        }        else if (ae.getActionCommand().equalsIgnoreCase("about"))        {            JOptionPane.showMessageDialog(null, this.createScollingLabel(this                .getFullCredits()), "About" + MainGUI.getDescription() + " "                + MainGUI.getVersion(), JOptionPane.INFORMATION_MESSAGE);        }        else if (ae.getActionCommand().equalsIgnoreCase("consoleDialog"))        {            if (!JHack.isUseConsole())                JHack.out.setEnabled(this.getPrefs().getValueAsBoolean(                    "consoleDialog"));        }        else if (ae.getActionCommand().equalsIgnoreCase("directio"))        {            //            this.getPrefs().setValueAsBoolean(            //                "useDirectFileIO",            //                !rom.isDirectFileIO());            if (rom.isLoaded && !(rom.isDirectFileIO()))            {                int ques = JOptionPane.showConfirmDialog(null,                    "Do you want to save your changes?", "Save?",                    JOptionPane.YES_NO_CANCEL_OPTION);                if (ques == JOptionPane.CANCEL_OPTION)                {                    return;                }                else if (ques == JOptionPane.YES_OPTION)                {                    rom.saveRom();                }            }            File rompath = null;            if (rom.isLoaded)                rompath = rom.getFilePath();            if (!rom.isDirectFileIO())            {                rom = new RomFileIO();            }            else            {                rom = new Rom();            }            //            HackModule.rom = rom;            if (rompath != null)                rom.loadRom(rompath);            for (int i = 0; i < getModuleCount(); i++)            {                try                {                    getModuleAt(i).rom = rom;                    getModuleAt(i).hide();                    getModuleAt(i).reset();                }                catch (NullPointerException npe)                {                    //If not module inited yet                }            }            System.gc();            //System.out.println("Debug: rom classname: " +            // rom.getClass().getName());        }        else if (ae.getActionCommand().startsWith("LAF_"))        {            String laf = ae.getActionCommand().substring(4);            prefs.setValue("laf", laf);            try            {                if (!UIManager.getLookAndFeel().getClass().getName()                    .equals(laf))                {                    UIManager.setLookAndFeel(laf);                    SwingUtilities.updateComponentTreeUI(SwingUtilities                        .getRoot(mainWindow));                    JHack.out.updateUI();                    JHack.err.updateUI();                    for (Iterator i = moduleList.iterator(); i.hasNext();)                        ((HackModule) i.next()).updateUI();                }            }            catch (ClassNotFoundException e)            {                e.printStackTrace();            }            catch (InstantiationException e)            {                e.printStackTrace();            }            catch (IllegalAccessException e)            {                e.printStackTrace();            }            catch (UnsupportedLookAndFeelException e)            {                e.printStackTrace();            }        }        else if (ae.getActionCommand().equals("selectDefROM"))        {            String romType;            if (rom.isLoaded)            {                romType = rom.getRomType();            }            else            {                //JDialog typeDia = new JDialog(mainWindow, "Select or Enter                // ROM Type", true);                //typeDia.getContentPane().setLayout(new BorderLayout());                JComboBox typeSel = new JComboBox(RomTypeFinder                    .getRomTypeNames());                typeSel.setEditable(true);                typeSel.setSelectedIndex(0);                //typeDia.add(typeSel, BorderLayout.NORTH);                if (JOptionPane.showConfirmDialog(mainWindow, typeSel,                    "Select or Enter ROM Type", JOptionPane.OK_CANCEL_OPTION,                    JOptionPane.QUESTION_MESSAGE) != JOptionPane.OK_OPTION)                    return;                romType = typeSel.getSelectedItem().toString();            }            getPrefs().removeValue(romType + ".orgRomPath");            getPrefs().removeValue(romType + ".expRomPath");            requestOrgRomFile(romType);        }        else if (ae.getActionCommand().startsWith("module"))        {            if (rom.isLoaded)            {                getModuleAt(                    Integer.parseInt(ae.getActionCommand().substring(6)))                    .show();            }            else            {                JOptionPane.showMessageDialog(null,                    "You must load a ROM first!", "Error!",                    JOptionPane.ERROR_MESSAGE);            }        }    }