Why have you posted in the GUIs forum when your question isn't about GUIs? Moving to a more appropriate location.
You have got the logic wrong for input from the keyboard. Yes, you need !myScanner.hasNextInt() but don't use an if‑else; use a loop:-But that will produce no end of code duplication. You would do better to put that loop in a method, and better still to put that method in a utility class which you can reuse for ever.Rob Spoor taught me that technique ages ago. It only works for one int at a time. You can overload that method to take onlly ints in a certain range.