minX, minY, maxX - minX + 1, maxY - minY + 1);
area.x, area.y, area.width + 1, area.height + 1);
    private void pour(MapLayer layer, int x, int y,            Tile newTile, Tile oldTile) {        if (newTile == oldTile) return;        int minX = x, minY = y;        int maxX = x, maxY = y;        Stack stack = new Stack();        MapLayer before = new MapLayer(layer);        before.setId(layer.getId());        MapLayer after;        stack.push(new Point(x, y));        while (!stack.empty()) {            // Remove the next tile from the stack            Point p = (Point)stack.pop();            // If the tile it meets the requirements, set it and push its            // neighbouring tiles on the stack.            if (currentMap.inBounds(p.x, p.y) &&                    layer.getTileAt(p.x, p.y) == oldTile)            {                layer.setTileAt(p.x, p.y, newTile);                if (minX > p.x) { minX = p.x; }                if (minY > p.y) { minY = p.y; }                if (maxX < p.x) { maxX = p.x; }                if (maxY < p.y) { maxY = p.y; }                stack.push(new Point(p.x, p.y - 1));                stack.push(new Point(p.x, p.y + 1));                stack.push(new Point(p.x + 1, p.y));                stack.push(new Point(p.x - 1, p.y));            }        }        Rectangle bounds = new Rectangle(                minX, minY, maxX - minX + 1, maxY - minY + 1);        after = new MapLayer(bounds);        after.copyFrom(layer);        after.setId(layer.getId());        MapLayerEdit mle = new MapLayerEdit(currentMap, before, after);        mle.setPresentationName("Fill");        undoSupport.postEdit(mle);    }