entries[tileset.getSelectedIndex()].getTileChange(selected / 2).setTile1((short) tileChooser.getSelected());
change.getTileChange(selected / 2).setTile1((short) tileChooser.getSelected());
	public void actionPerformed(ActionEvent e)	{		if (e.getActionCommand().equals("apply"))        {            int status = saveInfo();            if (status < 1)            	JOptionPane.showMessageDialog(mainWindow,            		    "ERROR: " + errorMessages[status * -1],            		    "Error saving changes!",            		    JOptionPane.ERROR_MESSAGE);            else if (! writeToRom(this))            	JOptionPane.showMessageDialog(mainWindow,            		    "ERROR: Not enough space for changes, so remove some!",            		    "Error writing!",            		    JOptionPane.ERROR_MESSAGE);        }        else if (e.getActionCommand().equals("close"))        	hide();        else if (e.getSource().equals(tileset))        	updateComponents(true);        else if (e.getSource().equals(palette))        	updateComponents(false);        else if (e.getSource().equals(page))        	updateComponents(false);        else if (e.getSource().equals(add))        {        	entries[tileset.getSelectedIndex()].addTileChange(        			new TilesetChange.TileChange((short) 0, (short) 0));        	updateComponents(false);        }        else if (e.getSource().equals(del))        {        	String input = JOptionPane.showInputDialog(                    mainWindow,                    "Delete which tile change?",                    Integer.toString(1));        	if ((input != null) && (input.length() > 0))        	{        		int num = Integer.parseInt(input) - 1;        		TilesetChange entry = entries[tileset.getSelectedIndex()];        		if ((num >= 0) && (num <= entry.size()))        		{        			if (selected / 2 == num)        				selected = -1;        			entry.removeTileChange(num);        			updateComponents(false);        		}        		else        			JOptionPane.showMessageDialog(mainWindow,                		    "ERROR: No change with number " + (num + 1) + "!",                		    "Error deleting!",                		    JOptionPane.ERROR_MESSAGE);        	}        }        else if ((e.getSource().equals(tileChooser)) && (selected != -1))        {        	if (selected % 2 == 0)    			entries[tileset.getSelectedIndex()].getTileChange(selected / 2).setTile1((short) tileChooser.getSelected());    		else    			entries[tileset.getSelectedIndex()].getTileChange(selected / 2).setTile2((short) tileChooser.getSelected());    		updateComponents(false);	        }        else if (e.getSource() instanceof TileButton)        {        	selected = Integer.parseInt(e.getActionCommand());        	if (selected % 2 == 0)        		tileChooser.setSelected(entries[tileset.getSelectedIndex()].getTileChange(selected / 2).getTile1());        	else        		tileChooser.setSelected(entries[tileset.getSelectedIndex()].getTileChange(selected / 2).getTile2());        	if (! tileChooser.isSelectedVisible())        		tileChooser.scrollToSelected();        	tileChooser.repaint();        }	}