private void updateTabs()
	{
		if(terrain == null)
		{
			return;
		}
		
		int width = terrain.getHeightMap(0).cols();
		int height = terrain.getHeightMap(0).rows();

		// plot heightmap
		try
		{
			int level = 0;
			int width2 = terrain.getHeightMap(level).cols();
			int height2 = terrain.getHeightMap(level).rows();
			Grid2DPlotter plotter = new Grid2DPlotter(terrain.getHeightMap(level,0,0));
			BufferedImage image = new BufferedImage(width2, height2, BufferedImage.TYPE_INT_ARGB);
			plotter.plot2image(image);
			plotter.plot2file("test_heightmap.txt");
			heightImageLabel.setIcon(new ImageIcon(image));
			
			// plot the heightmap layers
			int plotlayer = 2;
			Grid2DLayerPlotter<Double> layerplotter = new Grid2DLayerPlotter<Double>(terrain.getHeightmapLayer(plotlayer));
			layerplotter.plot2files("test_heightmap");
			
		} catch (IOException e)
		{
			e.printStackTrace();
		}

		// plot first resourcemap
		try
		{
			Grid2DPlotter plotter = new Grid2DPlotter(terrain.getResourceMap(ResourceType.COAL));
			BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
			plotter.plot2image(image);
			plotter.plot2file("test_resmap.txt");
			resourcesImageLabel.setIcon(new ImageIcon(image));
		} catch (IOException e)
		{
			e.printStackTrace();
		}

		// plot watersheds map
		try
		{
			Grid2DPlotter plotter = new Grid2DPlotter(terrain.getWatershedMap());
			BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
			plotter.plot2image(image);
			plotter.plot2file("test_watershedmap.txt");
			resourcesImageLabel.setIcon(new ImageIcon(image));
		} catch (IOException e)
		{
			e.printStackTrace();
		}

		// plot soil quality map
		try
		{
			Grid2DPlotter plotter = new Grid2DPlotter(terrain.getSoilQualityMap());
			BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
			plotter.plot2image(image);
			plotter.plot2file("test_soilmap.txt");
			resourcesImageLabel.setIcon(new ImageIcon(image));
		} catch (IOException e)
		{
			e.printStackTrace();
		}

		// plot city map
		try
		{
			Grid2DPlotter plotter = new Grid2DPlotter(cityGrid);
			BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
			plotter.plot2image(image);
			plotter.plot2file("test_citymap.txt");
			resourcesImageLabel.setIcon(new ImageIcon(image));
		} catch (IOException e)
		{
			e.printStackTrace();
		}

		// plot population density map
		try
		{
			Grid2DPlotter plotter = new Grid2DPlotter(populationDensity);
			BufferedImage image = new BufferedImage(populationDensity.cols(), populationDensity.rows(), BufferedImage.TYPE_INT_ARGB);
			plotter.plot2image(image);
			plotter.plot2file("test_populationdensitymap.txt");
			resourcesImageLabel.setIcon(new ImageIcon(image));
			
			// plot the heightmap layers
			int plotlayer = 1;
			Grid2DLayerPlotter<Double> layerplotter = new Grid2DLayerPlotter<Double>(civilization.getPopulationDensity(plotlayer));
			layerplotter.plot2files("test_populationdensitymap");
		} catch (IOException e)
		{
			e.printStackTrace();
		}

		// plot road map
		try
		{
			Grid2DPlotter plotter = new Grid2DPlotter(roadsGrid);
			BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
			plotter.plot2image(image);
			plotter.plot2file("test_roads.txt");
			resourcesImageLabel.setIcon(new ImageIcon(image));
		} catch (IOException e)
		{
			e.printStackTrace();
		}

		// plot forest map
		try
		{
			int forestType = 1;
			Grid2DPlotter plotter = new Grid2DPlotter(terrain.getForestMap(forestType));
			BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
			plotter.plot2image(image);
			plotter.plot2file("test_forestmap" + forestType + ".txt");
			resourcesImageLabel.setIcon(new ImageIcon(image));
		} catch (IOException e)
		{
			e.printStackTrace();
		}
	}