Hello I’m just staring out on java, and I’ve been looking everywhere how to make a UI that based on a Scanner would print the the following methods of parsing on separate window:
Character [A] located at position 0 is a vowel
Character [b] located at position 1 is a consonant
Character [r] located at position 2 is a consonant
Character [a] located at position 3 is a vowel
Character [h] located at position 4 is a consonant
...
16 [Abraham Lincoln ]
14 [braham Lincoln]
12 [raham Lincol]
10 [aham Linco]
8 [ham Linc]
6 [am Lin]
4 [m Li]
2 [ L]
0 []
I have the code for the methods that do that, but for now all I have is a Scanner that would transform any input I type on Eclipse’s console into a string that is then parsed.
String enterName;
Scanner name = new Scanner(System.in);
System.out.println("Enter your name");
enterName = name.nextLine();
Any help is really appreciated, thanks.
Using a
Scannerfor text input as you have presented above is the norm for console based applications.If you wish create a Graphical User interface you can use Java Swing and use a
JTextFieldto accept user input.Scanneris not needed in this case.