import java.awt.*; import java.awt.event.*; import javax.swing.*; // This code is responsible for displaying the terrain public class TerrainPanel extends JPanel { public static final Color[] colors = {new Color(0, 0, 0), new Color(0, 200, 0), new Color(0, 100, 0), new Color(0, 50, 200), new Color(255, 100, 0)}; public static final int SCALE = 4; private byte[][] terrain; private int width; private int height; public TerrainPanel(byte[][] t) { terrain = t; width = t[0].length; height = t.length; setPreferredSize(new Dimension(width*SCALE, height*SCALE)); } // Display the image public void paintComponent(Graphics g) { super.paintComponent(g); for (int i=0; i