This is a really nice way to get the user input from a TextArea
and as I only used the simple ActionListener, KeyListener etc. until now,
it's good to know.
I also made a tool with keyword suggestion, but I didn't need it there
because I used a thread there which checked the input every 1/25 sec.
I used the StringBuffer.reverse() method to compare the actual input to
a list of keywords.
But here the thread-approach is not a secure solution as you can see.
What I really need though is something equivalent to the Dialog function
I need something that behaves like the java.util.Scanner for the default System.in-console
with my TextArea.
Probably the easiest way to describe this is:
I want to emulate a console in my game.
For example i have a method:
1 2 3 4 5 6 7 8 9 10 11
| TextArea console; void enterUserData(){ console.append("Please enter your name\n"); String name = getInputFromConsole(); console.append("Which type of warrior do you want to be?\n"); console.append("(1) Assassin\n"); console.append("(2) Archer\n"); console.append("(3) Berserker\n"); String type = getInputFromConsole(); .... } |
I should have written this before, didn't I ?
