private void initGui() {
        getContentPane().setBackground(backgroundColor);       
        
        setTitle("BATTLEBOTS ARENA");
        
        ArrayList<Image> icons = new ArrayList<Image>();
        icons.add(new ImageIcon(getClass().getResource("icon16.png")).getImage());
        icons.add(new ImageIcon(getClass().getResource("icon32.png")).getImage());
        icons.add(new ImageIcon(getClass().getResource("icon64.png")).getImage());

        
        setIconImages(icons);
        
		setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
		
		JLabel title = new JLabel("BATTLEBOTS ARENA - ARENA SIZE " + xDim + "x" + yDim);
		title.setForeground(borderColor);
		
		score = new JLabel("BEGIN SIMULATION");
		score.setOpaque(true);
		score.setForeground(backgroundColor);
		score.setBackground(borderColor);
		score.addMouseListener(this);
		
		labelPencil = new JLabel("PENCIL");
		labelPencil.setOpaque(true);
		labelPencil.setForeground(backgroundColor);
		labelPencil.setBackground(borderColorInverted);
		labelPencil.addMouseListener(this);
		
		labelLine = new JLabel("LINE");
		labelLine.setOpaque(true);
		labelLine.setForeground(backgroundColor);
		labelLine.setBackground(borderColor);
		labelLine.addMouseListener(this);
		
		labelSquare = new JLabel("SQUARE");
		labelSquare.setOpaque(true);
		labelSquare.setForeground(backgroundColor);
		labelSquare.setBackground(borderColor);
		labelSquare.addMouseListener(this);
		
		saveButton = new JLabel("SAVE");
		saveButton.setOpaque(true);
		saveButton.setForeground(backgroundColor);
		saveButton.setBackground(borderColor);
		saveButton.addMouseListener(this);
		
		loadButton = new JLabel("LOAD");
		loadButton.setOpaque(true);
		loadButton.setForeground(backgroundColor);
		loadButton.setBackground(borderColor);
		loadButton.addMouseListener(this);
		
		lifeBot1 = new JLabel("Player 1 Health: 5/5");
		lifeBot1.setForeground(borderColor);
		lifeBot1.setVisible(false);
		
		lifeBot2 = new JLabel("Player 2 Health: 5/5");
		lifeBot2.setForeground(borderColor);
		lifeBot2.setVisible(false);

        JPanel containerPanel = new JPanel();
        containerPanel.setBackground(backgroundColor);
        containerPanel.setBorder(javax.swing.BorderFactory.createLineBorder(borderColor, borderWidth+2));

        innerBoxes = new GridSquare[xDim][yDim];
        for (int x = 0; x < yDim; x++) {
        	for (int y = 0; y < xDim; y++) {
        		GridSquare box = new GridSquare(x,y);
        		box.setName(x + " " + y);
        		box.addMouseListener(this);
        		box.setBorder(javax.swing.BorderFactory.createLineBorder(borderColor, borderWidth));
        		box.setBackground(backgroundColor);

        		javax.swing.GroupLayout innerBoxLayout = new javax.swing.GroupLayout(box);
        		box.setLayout(innerBoxLayout);
        		innerBoxLayout.setHorizontalGroup(
        			innerBoxLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGap(0, boxDimensions, Short.MAX_VALUE)
                );
        		innerBoxLayout.setVerticalGroup(
        			innerBoxLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGap(0, boxDimensions, Short.MAX_VALUE)
                );
        		innerBoxes[y][x] = box;
        	}
        }
        
        obstacles      = new boolean[xDim][yDim];
        transObstacles = new int[xDim][yDim];

        

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(containerPanel);
        containerPanel.setLayout(jPanel1Layout);
        
        ParallelGroup horizontalGroup = jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING);
        for (int x = 0; x < yDim; x++) {
    		SequentialGroup sequentialGroup = jPanel1Layout.createSequentialGroup();
        	for (int y = 0; y < xDim; y++) {
        		JPanel box = innerBoxes[y][x];
        		sequentialGroup.addComponent(box, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE);
            	if (y != xDim) {
            		sequentialGroup.addContainerGap(gap, Short.MAX_VALUE);
            	}

        	}
        	horizontalGroup.addGroup(sequentialGroup);
        }

            
        jPanel1Layout.setHorizontalGroup(
                jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel1Layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(horizontalGroup)
                    .addContainerGap()));
        
        
        SequentialGroup verticalGroup = jPanel1Layout.createSequentialGroup().addContainerGap();
        for (int x = 0; x < yDim; x++) {
    		ParallelGroup sequentialGroup = jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING);
        	for (int y = 0; y < xDim; y++) {
        		JPanel box = innerBoxes[y][x];
        		sequentialGroup.addComponent(box, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE);
        	}
        	verticalGroup.addGroup(sequentialGroup);
        	if (x == yDim) {
        		verticalGroup.addContainerGap(10, Short.MAX_VALUE);
        	}
        	else
        	{
        		verticalGroup.addContainerGap(gap, Short.MAX_VALUE);
        	}
        }

            
        jPanel1Layout.setVerticalGroup(
                jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(verticalGroup));
        
        
        
      
        
        
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(containerPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(10)
                .addComponent(score)
                .addGap(20)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(containerPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(10)
                .addComponent(lifeBot1)
                .addGap(20)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(containerPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(10)
                .addComponent(lifeBot2)
                .addGap(20)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(containerPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(10)
                .addComponent(labelPencil)
                .addGap(20)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
             .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(containerPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(10)
                .addComponent(labelLine)
                .addGap(20)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
             .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(containerPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(10)
                .addComponent(labelSquare)
                .addGap(20)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
             .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(containerPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(10)
                .addComponent(saveButton)
                .addGap(20)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
             .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(containerPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(10)
                .addComponent(loadButton)
                .addGap(20)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addComponent(title))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(title)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(containerPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
             .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGap(40)
                .addComponent(score)
                .addGap(20)
                .addComponent(lifeBot1)
                .addComponent(lifeBot2))
             .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGap(40)
                .addComponent(score)
                .addGap(20)
                .addComponent(labelPencil)
                .addGap(5)
                .addComponent(labelLine)
                .addGap(5)
                .addComponent(labelSquare)
                .addGap(20)
                .addComponent(saveButton)
                .addGap(5)
                .addComponent(loadButton))
        );

        pack();
	}