if ((!prefs.hasValue("updateFormat") && i == 0) || prefs.getValue("updateFormat").equals(compTypes[i][0]))
if ((formatPref == null && i == 0) || (formatPref != null && formatPref.equals(compTypes[i][0])))
    private void initGraphics()    {        //show loading dialog first        if (showload)        {            loadingDialog = new JFrame("Loading...");            loadingBar = new JProgressBar();            loadingDialog.getContentPane().add(loadingBar);            loadingDialog.setVisible(true);            loadingDialog.invalidate();            loadingDialog.setSize(200, 60);            loadingDialog.setResizable(false);            loadingDialog.validate();        }        loadPrefs();        //main init stuff        mainWindow.setTitle(MainGUI.getDescription() + " "            + MainGUI.getVersion());        mainWindow.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);        mainWindow.addWindowListener(this);        JMenuBar menuBar = new JMenuBar();        JMenu fileMenu = new JMenu("File");        fileMenu.setMnemonic('f');        fileMenu.add(HackModule.createJMenuItem("Open ROM...", 'o', "ctrl O",            "load", this));        fileMenu.add(HackModule.createJMenuItem("Close ROM", 'c', "ctrl F4",            "closeROM", this));        fileMenu.add(HackModule.createJMenuItem("Save ROM", 's', "ctrl S",            "save", this));        fileMenu.add(HackModule.createJMenuItem("Save ROM As...", 'a',            "ctrl A", "saveAs", this));        fileMenu.add(new JSeparator());        revertMenu = new JMenu("Revert");        revertMenu.setMnemonic('r');        fileMenu.add(revertMenu);        refreshRevertMenu();        fileMenu.add(new JSeparator());        for (int i = 0; i < recentLoadsItems.length; i++)        {            recentLoadsItems[i] = new JMenuItem();            recentLoadsItems[i].setMnemonic(Integer.toString(i + 1).charAt(0));            recentLoadsItems[i].setActionCommand("recentLoad" + i);            recentLoadsItems[i].addActionListener(this);            recentLoadsItems[i].setVisible(false);            fileMenu.add(recentLoadsItems[i]);        }        refreshRecentLoads();        fileMenu.add(new JSeparator());        fileMenu.add(HackModule.createJMenuItem("Exit", 'x', "alt F4", "exit",            this));        menuBar.add(fileMenu);        JMenu optionsMenu = new JMenu("Options");        optionsMenu.setMnemonic('o');        optionsMenu.add(new PrefsCheckBox("Display Console Dialog", prefs,            "consoleDialog", false, 'c', null, "consoleDialog", this));        JMenu toolkitMenu = new JMenu("Look & Feel");        toolkitMenu.setMnemonic('f');        UIManager.LookAndFeelInfo[] lafi = UIManager.getInstalledLookAndFeels();        ButtonGroup lafbg = new ButtonGroup();        for (int i = 0; i < lafi.length; i++)        {            if (lafi[i].getName().equals("CDE/Motif"))                continue;            JRadioButtonMenuItem laf = new JRadioButtonMenuItem(lafi[i]                .getName());            laf.setSelected(UIManager.getLookAndFeel().getName().equals(                lafi[i].getName()));            laf.setActionCommand("LAF_" + lafi[i].getClassName());            laf.addActionListener(this);            lafbg.add(laf);            toolkitMenu.add(laf);        }        optionsMenu.add(toolkitMenu);        optionsMenu.add(new PrefsCheckBox("Use Hex Numbers", prefs,            "useHexNumbers", true, 'h'));        optionsMenu.addSeparator();        optionsMenu.add(new PrefsCheckBox("Use Direct File IO", prefs,            "useDirectFileIO", false, 'd', null, "directio", this));        optionsMenu.add(new PrefsCheckBox("Load Last ROM on Startup", prefs,            "autoLoad", true, 'l'));        optionsMenu.add(HackModule.createJMenuItem("Change Default ROM...",            'c', null, "selectDefROM", this));        optionsMenu.addSeparator();        optionsMenu.add(new PrefsCheckBox("Auto Check for Updates", prefs,            "checkVersion", true, 'u'));        JMenu compType = new JMenu("Prefered Compression Format");        compType.setMnemonic('p');        String[][] compTypes = new String[][]{{"zip", "ZIP, most common"},            {"bz2", "BZip2"}, {"rar", "RAR"}, {"7z", "7-Zip, best"}};        ButtonGroup compTypeGroup = new ButtonGroup();        for (int i = 0; i < compTypes.length; i++)        {            JRadioButtonMenuItem type = new JRadioButtonMenuItem("."                + compTypes[i][0] + " (" + compTypes[i][1] + ")");            type.setMnemonic(compTypes[i][0].charAt(0));            type.setActionCommand("comptype_" + compTypes[i][0]);            type.addActionListener(this);            compType.add(type);            compTypeGroup.add(type);            if ((!prefs.hasValue("updateFormat") && i == 0)                || prefs.getValue("updateFormat").equals(compTypes[i][0]))                type.setSelected(true);        }        optionsMenu.add(compType);        menuBar.add(optionsMenu);        JMenu helpMenu = new JMenu("Help");        helpMenu.setMnemonic('h');        helpMenu.add(HackModule.createJMenuItem("About...", 'a', null, "about",            this));        menuBar.add(Box.createHorizontalGlue());        menuBar.add(helpMenu);        mainWindow.setJMenuBar(menuBar);        //add buttons        String[] spList = initModules();        /*         * int spaces = 0; for (int i = 0; i < spList.length; i++) if         * (spList[i])         */        buttons = new Box(BoxLayout.Y_AXIS);        Box currBox = null;        HeadingLabel prevLabel = null;        //buttons.setLayout(new GridLayout(getModuleCount() + spaces, 1));        JScrollPane scroll = new JScrollPane(buttons,            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);        modButtons = new JButton[getModuleCount()];        for (int i = 0; i < getModuleCount(); i++)        {            if (spList[i] != null)            {                if (currBox != null)                {                    buttons.add(currBox);                    currBox.setVisible(false);                    if (prevLabel != null)                        prevLabel.setCollapsableArea(currBox);                }                currBox = new Box(BoxLayout.Y_AXIS);                if (spList[i] == "")                    buttons.add(Box.createVerticalStrut(16));                else                {                    HeadingLabel t = new HeadingLabel(spList[i],                        SwingConstants.CENTER);                    t.setMaximumSize(new Dimension(274, 16));                    buttons.add(t);                    prevLabel = t;                }            }            modButtons[i] = new JButton(getModuleAt(i).getDescription());            if (getModuleAt(i).getIcon() != null)            {                modButtons[i].setIcon(getModuleAt(i).getIcon());            }            modButtons[i].setActionCommand("module" + i);            modButtons[i].addActionListener(this);            modButtons[i].setMaximumSize(new Dimension(274, 26));            currBox.add(modButtons[i]);        }        if (currBox != null)        {            currBox.setVisible(false);            buttons.add(currBox);            if (prevLabel != null)                prevLabel.setCollapsableArea(currBox);        }        mainWindow.getContentPane().add(scroll);        if (showload)        {            loadingDialog.setVisible(false);        }        mainWindow.setVisible(true);        mainWindow.invalidate();        mainWindow.setBounds(200, 200, 300, 400);        mainWindow.validate();        mainWindow.setResizable(false);    }