arrImg = new BufferedImage(arrangementEditor.getWidth(), arrangementEditor.getHeight(), BufferedImage.TYPE_INT_RGB); screenSelector.removeActionListener(this); int realSelectedScreen = screenSelector.getSelectedIndex(); screenSelector.setSelectedIndex(0); arrangementEditor.paint(arrImg.getGraphics()); screenSelector.setSelectedIndex(realSelectedScreen); screenSelector.addActionListener(this);
cacheArrImg(); } } else if (ae.getActionCommand().equals("paletteEditor")) { int frame = getCurrentSubPalette(); int col = pal.getSelectedColorIndex(); if (screenSelector.getSelectedIndex() == 0 && frame >= 0 && frame < TitleScreen.NUM_CHAR_ANIM_PALETTES && (col < 128 || col >= 144)) { JOptionPane.showMessageDialog(mainWindow, "Sorry, at this point in the animation,\n" + "that color is always black.\n" + "Try editing that color later on in the animation\n" + "or edit the graphics/arrangement so that you are\n" + "using one of the letters animated palette colors.", "Unable to edit color", JOptionPane.INFORMATION_MESSAGE); return; } else if (frame == TitleScreen.NUM_CHAR_ANIM_PALETTES + TitleScreen.NUM_ANIM_PALETTES + 1) { JOptionPane.showMessageDialog(mainWindow, "Sorry, the \"Initial Flash\" colors\n" + "are hardcoded and cannot be changed.", "Unable to edit color", JOptionPane.INFORMATION_MESSAGE); return;
    public void actionPerformed(ActionEvent ae)    {        if (ae.getActionCommand().equals("mapSelector")            || ae.getActionCommand().equals("subPalSelector"))        {            if (screenSelector.getSelectedIndex() != 0)            {                arrImg = new BufferedImage(arrangementEditor.getWidth(),                    arrangementEditor.getHeight(), BufferedImage.TYPE_INT_RGB);                screenSelector.removeActionListener(this);                int realSelectedScreen = screenSelector.getSelectedIndex();                screenSelector.setSelectedIndex(0);                arrangementEditor.paint(arrImg.getGraphics());                screenSelector.setSelectedIndex(realSelectedScreen);                screenSelector.addActionListener(this);            }        }        super.actionPerformed(ae);        if (ae.getActionCommand().equals("subPalSelector"))        {            tileSelector.repaint();            (screenSelector.getSelectedIndex() == 0                ? (JComponent) arrangementEditor                : (JComponent) lpe).repaint();        }        else if (ae.getActionCommand().equals("paletteEditor"))        {            lpe.repaint();        }        else if (ae.getActionCommand().equals("mapSelector"))        {            mainWindow.getContentPane().invalidate();            tileSelector.invalidate();            tileSelector.resetPreferredSize();            tileSelector.validate();            tileSelector.repaint();            arrangementEditor                .setVisible(screenSelector.getSelectedIndex() == 0);            lpe.setVisible(screenSelector.getSelectedIndex() == 1);            mainWindow.getContentPane().validate();        }    }