File tree Expand file tree Collapse file tree
src/main/java/com/npmanos/clmenu Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33import java .io .Console ;
44import java .util .ArrayList ;
55import java .util .List ;
6+ import java .util .Scanner ;
67
78import static java .util .Collections .unmodifiableList ;
89
@@ -11,14 +12,14 @@ public class CLMenu {
1112 private final List <MenuOption > options ;
1213 private final boolean isSubmenu ;
1314
14- private Console in ;
15+ private Scanner in ;
1516
1617 private CLMenu (String name , List <MenuOption > options , boolean isSubmenu ) {
1718 this .name = name ;
1819 this .options = options ;
1920 this .isSubmenu = isSubmenu ;
2021
21- in = System .console ( );
22+ in = new Scanner ( System .in );
2223 }
2324
2425 private CLMenu (String name , List <MenuOption > options ) {
@@ -81,7 +82,7 @@ private int select() {
8182 System .out .print ("Select an option: " );
8283 int selection ;
8384 try {
84- selection = Integer .parseInt (in .readLine ());
85+ selection = Integer .parseInt (in .nextLine ());
8586 } catch (NumberFormatException e ) {
8687 System .out .println ();
8788 System .out .println ("INVALID SELECTION!" );
You can’t perform that action at this time.
0 commit comments