private void setupMenuBar() {
        final Component comp = this;
        final NESModelListener listener = this;
        bg = new ButtonGroup();
        JMenuBar menuBar = new JMenuBar();
        getContentPane().add(menuBar, BorderLayout.NORTH);

        JMenu fileMenu = GUIUtilities.createMenu(menuBar, "File", 'F');

        JMenu projMenu = GUIUtilities.createSubMenu(fileMenu, "Project", 'P');

        GUIUtilities.createMenuItem(projMenu, "New", 'N', new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                modelRef.newProject(comp, listener);

                int compressVal = modelRef.getNameTableCompression();
                Enumeration<AbstractButton> modelEnum = bg.getElements();
                AbstractButton tempButtonModel = modelEnum.nextElement();
                while (compressVal > 0 && modelEnum.hasMoreElements()) {
                    compressVal--;
                    tempButtonModel = modelEnum.nextElement();
                }
                if (tempButtonModel != null) {
                    tempButtonModel.setSelected(true);
                }
            }
        });
        GUIUtilities.createMenuItem(projMenu, "Load", 'L', new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                modelRef.loadProject(comp, listener);
                updateCompressionInfo();
            }
        });
        GUIUtilities.createMenuItem(projMenu, "Save", 'S', new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                modelRef.saveProject(comp, listener);
            }
        });
        GUIUtilities.createMenuItem(projMenu, "Save As...", 'A', new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                modelRef.saveAsProject(comp, listener);
            }
        });



        JMenu patternMenu = GUIUtilities.createSubMenu(fileMenu, "Pattern Tables (Tiles)", 'T');

        GUIUtilities.createMenuItem(patternMenu, "Load", 'L', new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                modelRef.loadPatternTables(comp, listener);
            }
        });
        GUIUtilities.createMenuItem(patternMenu, "Save", 'S', new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                modelRef.savePatternTables(comp, listener);
            }
        });
        GUIUtilities.createMenuItem(patternMenu, "Save As...", 'A', new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                modelRef.saveAsPatternTables(comp, listener);
            }
        });

        JMenu partialMenu = GUIUtilities.createSubMenu(patternMenu, "Partial", 'P');

        GUIUtilities.createMenuItem(partialMenu, "Load 4K Bank ", 'L', new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                modelRef.loadPatternTablesPortion(comp, listener);
            }
        });
       

        GUIUtilities.createMenuItem(partialMenu, "Save Active Bank", 'A', new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                modelRef.savePatternTableBankPortion(comp, listener);
            }
        });
        GUIUtilities.createMenuItem(partialMenu, "Save Portion of Bank ", 'S', new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                getPartialBank();
            }
        });




        JMenu nameTableMenu = GUIUtilities.createSubMenu(fileMenu, "Name Table (Background)", 'N');

        GUIUtilities.createCheckboxMenuItem(nameTableMenu, "ASCII", 'A', modelRef.getNameTableAsciiMode(), new ItemListener() {

            public void itemStateChanged(ItemEvent e) {
                modelRef.setNameTableAsciiMode(e.getStateChange() == ItemEvent.SELECTED);
            }
        });

        JMenu compressionMenu = GUIUtilities.createSubMenu(nameTableMenu, "Compression", 'C');


        GUIUtilities.createRadioMenuItem(compressionMenu, "None", 'N', bg, new ItemListener() {

            public void itemStateChanged(ItemEvent e) {
                if (e.getStateChange() == ItemEvent.SELECTED) {
                    modelRef.setNameTableCompression(CompressionUtilities.NO_COMPRESSION);
                }
            }
        });
        GUIUtilities.createRadioMenuItem(compressionMenu, "Run Length Encoding (RLE)", 'R', bg, new ItemListener() {

            public void itemStateChanged(ItemEvent e) {
                if (e.getStateChange() == ItemEvent.SELECTED) {
                    modelRef.setNameTableCompression(CompressionUtilities.RLE_COMPRESSION);
                }
            }
        });

        GUIUtilities.createMenuItem(nameTableMenu, "New", 'N', new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                modelRef.newNameTable(comp, listener);
            }
        });

        GUIUtilities.createMenuItem(nameTableMenu, "Load", 'L', new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                modelRef.loadNameTable(comp, listener);
                updateCompressionInfo();
            }
        });
        GUIUtilities.createMenuItem(nameTableMenu, "Save", 'S', new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                modelRef.saveNameTable(comp, listener);
            }
        });
        GUIUtilities.createMenuItem(nameTableMenu, "Save As...", 'A', new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                modelRef.saveAsNameTable(0, comp, listener);
            }
        });


        JMenu paletteMenu = GUIUtilities.createSubMenu(fileMenu, "Palette", 'L');
        GUIUtilities.createMenuItem(paletteMenu, "Load", 'L', new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                modelRef.loadPalette(comp, listener);
            }
        });

        GUIUtilities.createMenuItem(paletteMenu, "Save", 'S', new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                modelRef.savePalette(comp);
            }
        });
        GUIUtilities.createMenuItem(paletteMenu, "Save As...", 'A', new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                modelRef.saveAsPalette(comp);
            }
        });

        JMenu partialPalMenu = GUIUtilities.createSubMenu(paletteMenu, "Partial", 'P');
        GUIUtilities.createMenuItem(partialPalMenu, "Save Background Palette", 'B', new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                modelRef.saveSpecificPalette(comp, listener, PPUConstants.IMAGE_PALETTE_TYPE, 0, PPUConstants.NES_IMAGE_PALETTE_SIZE);
            }
        });
        GUIUtilities.createMenuItem(partialPalMenu, "Save Sprite Palette", 'S', new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                modelRef.saveSpecificPalette(comp, listener, PPUConstants.SPRITE_PALETTE_TYPE, 0, PPUConstants.NES_SPRITE_PALETTE_SIZE);
            }
        });

        JMenu animationMenu = GUIUtilities.createSubMenu(fileMenu, "Animation", 'A');
        GUIUtilities.createMenuItem(animationMenu, "Load", 'L', new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                modelRef.loadAnimations(comp, listener);
            }
        });
        GUIUtilities.createMenuItem(animationMenu, "Save", 'S', new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                modelRef.saveAnimations(comp);
            }
        });
        GUIUtilities.createMenuItem(animationMenu, "Save As...", 'A', new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                modelRef.saveAsAnimations(comp);
            }
        });

        JMenu guiMenu = GUIUtilities.createMenu(menuBar, "GUI", 'G');

        GUIUtilities.createMenuItem(guiMenu, "View Animation Panel", 'V', new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                setupAnimationPanel();
            }
        });
        GUIUtilities.createMenuItem(guiMenu, "Hide Animation Panel", 'H', new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                clearAnimationPanel();
            }
        });

        JMenu selectionMenu = GUIUtilities.createMenu(menuBar, "Selection", 'S');
        GUIUtilities.createMenuItem(selectionMenu, "Reorder Selected Tiles", 'R', new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                if (nameTableRegions[0] != null) {
                	launchNameTableReorder();
                }
            }
        });

        GUIUtilities.createMenuItem(selectionMenu, "Create Stamp", 'S', new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                if (nameTableRegions[0] != null) {
                	createStamp();
                }
            }
        });

        
        JMenu utilsMenu = GUIUtilities.createMenu(menuBar, "Utils", 'U');

        GUIUtilities.createMenuItem(utilsMenu, "Save Background as Image", 'S', new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                if (nameTableRegions[0] != null) {
                    nameTableRegions[0].exportAsImage();
                }
            }
        });
        
       
        
        GUIUtilities.createMenuItem(utilsMenu, "Create Test ROM", 'C', new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                saveResultsToROM();
            }
        });
        GUIUtilities.createMenuItem(utilsMenu, "Extract from Test ROM", 'X', new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                extractResultsFromTestROM();
            }
        });


    }