private void customGame()
    {
    	JPanel custom = new JPanel(new GridLayout(3, 2)); // Make the panel to go inside optionPane
    	
    	JLabel rowsL = new JLabel("Number of rows:");
    	JLabel colsL = new JLabel("Number of columns:");
    	JLabel minesL = new JLabel("Number of mines:");
    	JTextField rowsF = new JTextField();
    	JTextField colsF = new JTextField();
    	JTextField minesF = new JTextField();
    	
    	custom.add(rowsL);
    	custom.add(rowsF);
    	custom.add(colsL);
    	custom.add(colsF);
    	custom.add(minesL);
    	custom.add(minesF);
    	
    	String[] options = {"Start", "Cancel"};
    	
    	int result = JOptionPane.showOptionDialog(frame, 
    					custom, 
    					"Custom Settings", 
    					JOptionPane.YES_NO_OPTION,
    					JOptionPane.PLAIN_MESSAGE,
    					null,
    					options,
    					"Start");
    	
    	// Input sanitation
    	if(result == 0) {
    		String[] settingsRaw = {rowsF.getText().trim(), 
    							colsF.getText().trim(),
    							minesF.getText().trim()};
    		Integer[] settings = {null, null, null};
    		
    		// Check if input values are integers
    		for(int i = 0; i < 3 ; i++) {
    			if(isInt(settingsRaw[i])) {
    				settings[i] = Integer.parseInt(settingsRaw[i]);
    			}
    			else {
    				JOptionPane.showMessageDialog(frame, 
    						"You must enter whole numbers.", "Input Error",
    						JOptionPane.ERROR_MESSAGE);
    				return;
    			}
    		}
    		
    		// Check if values are 0
    		for(int setting : settings) {
    			if(setting <= 0) {
    				JOptionPane.showMessageDialog(frame,
    						"Your numbers must be bigger than 0.", "Size Error",
    						JOptionPane.ERROR_MESSAGE);
    				return;
    			}
    		}
    		
    		/*
    		 * Check that rows and columns aren't > 50
    		 * because large grids hugely affect performance
    		 * and don't fit properly on screen
    		 */
    		if(settings[0] > 50 || settings[1] > 50) {
    			JOptionPane.showMessageDialog(frame, 
    					"You aren't allowed more than 50 rows or columns.", 
    					"Mine Field Too Large", JOptionPane.ERROR_MESSAGE);
    			return;
    		}
    		
    		// Check if there are more mines than space on the mineField
    		if(settings[2] >= (settings[0] * settings[1])) {
    			JOptionPane.showMessageDialog(frame, 
    					"You can't have this many mines on the field.", "Too Many Mines", 
    					JOptionPane.ERROR_MESSAGE);
    			return;
    		}
    		
    		// Create the contentPane with the chosen MineField size and mines
            contentPane.removeAll();
            contentPane.add(makeTopPanel(selectedFieldSize), BorderLayout.NORTH);
            contentPane.add(new MineField(settings[0], settings[1], settings[2]), BorderLayout.CENTER);
            frame.pack();
            resizeFrame(settings[0], settings[1]);
    	}
    }