private void removeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeButtonActionPerformed
    	int targetLayer;
    	try{
        	//throws NumberFormatException if not a Number.
    		targetLayer = Integer.parseInt(whichLayerTextField.getText())-1;
    		//throws NullPointerException if Network has not been initialized.
    		if (targetLayer < myNetwork.getLayerCount() && targetLayer >= 0 && myNetwork.howManyInLayer(targetLayer)>0){
    			int whereTo;
                //We never shrink the column size so we can just remove the NeuronButton and add a label to the end of the row
                whereTo = gridPanelLayout.getColumns()*targetLayer-1 + myNetwork.howManyInLayer(targetLayer);
        		gridPanel.remove(whereTo);
        		whereTo = gridPanelLayout.getColumns()*targetLayer-1 + gridPanelLayout.getColumns();
    			gridPanel.add(new JLabel(""),whereTo);
                gridPanel.setVisible(false);
                gridPanel.setVisible(true);
                myNetwork.removeNeuron(targetLayer);
    		} else {
    			if(myNetwork.howManyInLayer(targetLayer)==0){
    				JOptionPane.showMessageDialog(this, "There are no Neurons to remove!");	
    			} else{
    			JOptionPane.showMessageDialog(this, "The layer can only be between 1 and " + (myNetwork.getLayerCount()));
    			}    			
    		}
            //NeuronButton geladen = (NeuronButton) gridPanel.getComponent(4);
            //geladen.setEnabled(false);
    		
        }  catch (NumberFormatException e){
        	JOptionPane.showMessageDialog(this, whichLayerTextField.getText() + " is not a valid layer");
        }  catch(NullPointerException e){
        	JOptionPane.showMessageDialog(this, "Please setup a Network first.");
        }    	
    }//GEN-LAST:event_removeButtonActionPerformed