TilesetChange entry = entries[tileset.getSelectedIndex()];
	private void updateComponents(boolean changingTileset)	{		TilesetChange entry = entries[tileset.getSelectedIndex()];		if (changingTileset)		{			flag.setText(Integer.toHexString(entry.getFlag() & 0xffff));			reverse.setSelected(entry.isFlagReversed());	        palette.removeActionListener(this);	        palette.removeAllItems();	        TileEditor.Tileset tset = TileEditor.tilesets[tileset.getSelectedIndex()];	        for (int i = 0; i < tset.getPaletteCount(); i++)	        {	            palette.addItem(new String(	               tset.getPalette(i).mtileset + "/"	                    + tset.getPalette(i).mpalette));	        }	        palette.addActionListener(this);			int formerPage = page.getSelectedIndex();			page.removeActionListener(this);			page.removeAllItems();			int extra = 0;			if ((entry.size() % Integer.parseInt(limit.getText()) > 0) || (entry.size() == 0))				extra = 1;			if (Integer.parseInt(limit.getText()) > 0)				for (int i = 0; i < (entry.size() / Integer.parseInt(limit.getText())) + extra; i++)					page.addItem("Page " + (i + 1));			for (int i = formerPage; i >= 0; i--)				if (page.getItemAt(i) != null)				{					page.setSelectedIndex(i);					i = -1;				}			page.addActionListener(this);		}				tilesPanel.removeAll();		flag.setEnabled(entry.size() > 0);		reverse.setEnabled(entry.size() > 0);		del.setEnabled(entry.size() > 0);		if (entry.size() > 0)		{			group = new ButtonGroup();			int start = Integer.parseInt(limit.getText()) * page.getSelectedIndex(), end;			if (start + Integer.parseInt(limit.getText()) > entry.size())				end = entry.size();			else				end = start + Integer.parseInt(limit.getText());			if (entry.size() - 1 < selected / 2)				selected = -1;			for (int i = start; i < end; i++)			{				TilesetChange.TileChange change = entry.getTileChange(i);				JPanel row = new JPanel();				row.add(new JLabel("#" + (i + 1) + " Before: "));				TileButton button = new TileButton(change.getTile1(), tileset.getSelectedIndex(), palette.getSelectedIndex());				if (i * 2 == selected)				{					button.setSelected(true);					if (changingTileset)						tileChooser.setSelected(change.getTile1());				}				group.add(button);				button.setActionCommand(Integer.toString(i * 2));				button.addActionListener(this);				row.add(button);				row.add(new JLabel(" After: "));				button = new TileButton(change.getTile2(), tileset.getSelectedIndex(), palette.getSelectedIndex());				if (i * 2 + 1 == selected)				{					button.setSelected(true);					if (changingTileset)						tileChooser.setSelected(change.getTile1());				}				group.add(button);				button.setActionCommand(Integer.toString(i * 2 + 1));				button.addActionListener(this);				row.add(button);				tilesPanel.add(row);			}		}		else			tilesPanel.add(new JLabel("No tile changes."));				tileChooser.setTsetPal(tileset.getSelectedIndex(), palette.getSelectedIndex());		tileChooser.repaint();				mainWindow.pack();	}