Can we take input from a Alert message in Java?? | Sololearn: Learn to code for FREE!
+ 1

Can we take input from a Alert message in Java??

Working on a code which do not use An IDE need to throw a dialogue in between and ask for input can we have such thing

17th Jul 2017, 8:09 AM
GAURAV
GAURAV - avatar
3 odpowiedzi
+ 1
On JavaScript: var name = prompt("Enter your name...", "John Doe"); // And some logic here if (name == "GAURAV") { alert("Hello " + name + "!"); } else { alert("Sorry! I don't know who is " + name + "."); } For Java you should use the JavaFX library. Here are some examples (scroll to "Text Input Dialogs"): http://code.makery.ch/blog/javafx-dialogs-official/
17th Jul 2017, 10:37 AM
Boris Batinkov
Boris Batinkov - avatar
+ 1
No, but you can use 'prompt', if you meant JavaScript.
17th Jul 2017, 9:24 AM
Boris Batinkov
Boris Batinkov - avatar
+ 1
how??
17th Jul 2017, 9:35 AM
GAURAV
GAURAV - avatar