Closed Namdrib closed 4 years ago
in Minesweeper.rbMenuItem.addActionListener, entering a bad input for heightField, widthField or minesField (e.g. empty strings, non-numerical input, etc.) should result in beginner values for each incorrect field.
try { newHeight = Integer.parseInt(heightField.getText()); } catch (NumberFormatException ex) { newHeight = 9; } try { newWidth = Integer.parseInt(widthField.getText()); } catch (NumberFormatException ex) { newWidth = 9; } try { newMines = Integer.parseInt(minesField.getText()); } catch (NumberFormatException ex) { newMines = 10; }
This requires an individual try/catch since each field is treated individually
Current behaviour is to just abort changing the difficulty
Fixed by 9db1c0f
in Minesweeper.rbMenuItem.addActionListener, entering a bad input for heightField, widthField or minesField (e.g. empty strings, non-numerical input, etc.) should result in beginner values for each incorrect field.
This requires an individual try/catch since each field is treated individually