SelectionLayer sl = new SelectionLayer(myMap.getWidth(), myMap.getHeight()); ListIterator itr = myMap.getLayers(); while(itr.hasNext()) { MapLayer layer = (MapLayer) itr.next(); Rectangle bounds = layer.getBounds(); for (int y = 0; y < bounds.height; y++) { for (int x = 0; x < bounds.width; x++) { if(layer.getTileAt(x,y) == (Tile) searchCBox.getSelectedItem()) { sl.select(x,y); } } } } myMap.addLayer(sl); myMap.touch();
	public void actionPerformed(ActionEvent e) {		String command = e.getActionCommand();				if(command.equalsIgnoreCase("cancel")) {			//TODO: this must untrigger the drawing condition			this.dispose();		} else if(command.equalsIgnoreCase("find")) {			//TODO: find must trigger a drawing condition to highlight instances of the found tile on the map					} else if(command.equalsIgnoreCase("find all")) {								} else if(command.equalsIgnoreCase("replace all")) {			replaceAll((Tile) searchCBox.getSelectedItem(),(Tile) replaceCBox.getSelectedItem());		}			}