tilesetBox = new Box(BoxLayout.Y_AXIS) { public void setEnabled(boolean b) { super.setEnabled(b); tileset.setEnabled(b); tilesetPal.setEnabled(b); } }; tilesetBox.add(getLabeledComponent("Tileset: ", tileset = createComboBox(TileEditor.TILESET_NAMES, this))); tileset.setActionCommand("tilesetSel"); tilesetBox.add(getLabeledComponent("Tileset Palette:", tilesetPal = new JComboBox())); tilesetPal.setActionCommand("palNumChanged"); tilesetPal.addActionListener(this); tileset.setSelectedIndex(0); entryEast.add(tilesetBox); tilesetBox.setEnabled(false);
    protected void init()    {        SpriteEditor.initSptNames(rom.getPath());        mainWindow = createBaseWindow(this);        mainWindow.setTitle(this.getDescription());        //mainWindow.setSize(600, 510);        mainWindow.getContentPane().add(            new JSearchableComboBox(selector = createJComboBoxFromArray(                new String[NUM_ENTRIES * 16], false), "Sprite: "),            BorderLayout.NORTH);        selector.setActionCommand("spriteSelector");        selector.addActionListener(this);        JPanel entry = new JPanel(new BorderLayout());        JPanel entryEast = new JPanel();        entryEast.setLayout(new BoxLayout(entryEast, BoxLayout.Y_AXIS));        entryEast.add(getLabeledComponent("Address: ",            addressLabel = new JLabel()));        entryEast.add(getLabeledComponent("Palette: ",            palNum = createJComboBoxFromArray(new Object[8])));        palNum.setActionCommand("palNumChanged");        palNum.addActionListener(this);        entryEast.add(HackModule.pairComponents(getLabeledComponent("Zoom: ",            pairComponents(zoom = new JTextField(4), new JLabel("%"), true)),            new JLabel(), false));        zoom.setText("1000");        zoom.getDocument().addDocumentListener(this);        DrawingToolset dt = new DrawingToolset(this);        entryEast.add(dt);        entry            .add(pairComponents(entryEast, dt, false, true), BorderLayout.EAST);        spal = new SpritePalette(16);        spal.setActionCommand("spal");        spal.addActionListener(this);        JPanel spalWrapper = new JPanel(new FlowLayout());        spalWrapper.add(spal);        entry.add(spalWrapper, BorderLayout.SOUTH);        spriteDrawingArea = new IntArrDrawingArea(dt, spal);        spriteDrawingArea.setZoom(10);        spriteDrawingArea.setPreferredSize(new Dimension(10 * 32, 10 * 32));        entry            .add(jsp = new JScrollPane(spriteDrawingArea), BorderLayout.CENTER);        mainWindow.getContentPane().add(entry, BorderLayout.CENTER);        //menu        JMenuBar mb = new JMenuBar();        JMenu fileMenu = new JMenu("File");        fileMenu.setMnemonic('f');        fileMenu.add(HackModule.createJMenuItem("Import sprite...", 'i', null,            "importImg", this));        fileMenu.add(HackModule.createJMenuItem("Export sprite...", 'e', null,            "exportImg", this));        mb.add(fileMenu);        JMenu editMenu = HackModule.createEditMenu(this, true);        editMenu.addSeparator();        editMenu.add(HackModule.createJMenuItem("H-Flip", 'h', null, "hFlip",            this));        editMenu.add(HackModule.createJMenuItem("V-Flip", 'v', null, "vFlip",            this));        mb.add(editMenu);        JMenu optionsMenu = new JMenu("Options");        optionsMenu.setMnemonic('o');        showRepeats = new JCheckBoxMenuItem("Show repeat sprites");        showRepeats.setMnemonic('s');        showRepeats.setSelected(false);        showRepeats.setActionCommand("showRepeats");        showRepeats.addActionListener(this);        optionsMenu.add(showRepeats);        gridLines = new JCheckBoxMenuItem("Show gridLines");        gridLines.setMnemonic('g');        gridLines.setSelected(true);        gridLines.setActionCommand("gridLines");        gridLines.addActionListener(this);        optionsMenu.add(gridLines);        optionsMenu.add(HackModule.createJMenuItem("Set background color", 'b',            null, "setBgColor", this));        optionsMenu.add(HackModule.createJMenuItem("Jump to SPT Editor", 'j',            null, "jumpSPT", this));        mb.add(optionsMenu);        mainWindow.setJMenuBar(mb);        addDataListener(sptNames, new ListDataListener()        {            public void contentsChanged(ListDataEvent lde)            {                initSelector(showRepeats.isSelected());            }            public void intervalAdded(ListDataEvent arg0)            {}            public void intervalRemoved(ListDataEvent arg0)            {}        });        mainWindow.pack();    }