Joptionpane character input

Joptionpane character input

By: gorfreeman Date of post: 30.06.2017

I'm working on a hangman program in Java, and part of my code will be to obtain single letter guesses from the user through the JOptionPane dialog box this is the input method my professor prefers as opposed to the scanner. I'm pretty new and have only gotten input from this dialog box as a string then converted the input to an int or double. I've been trying to find a way to get the input as a char but still use the dialog box.

What you could do is loop until the user puts in one and only one character.

Then, convert the String to a char. There is no way to return directly a char from JOptionPane showInputDialog see Oracle's Website. By posting your answer, you agree to the privacy policy and terms of service.

java - JOptionPane char input - Stack Overflow

Stack Overflow Questions Developer Jobs Documentation beta Tags Users. Sign up or log in to customize your list. Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us.

joptionpane character input

Log In Sign Up. Join the Stack Overflow Community.

Caesar Cipher In Java - Java | urisofod.web.fc2.com

Stack Overflow is a community of 7. Join them; it only takes a minute: JOptionPane char input Ask Question.

Anyone have a solution or know where I could look to find one? Yassin Hajaj 11k 4 18 Sign up or log in StackExchange. Sign up using Facebook.

Sign up using Email and Password. Post as a guest Name.

joptionpane character input

Stack Overflow works best with JavaScript enabled. MathOverflow Mathematics Cross Validated stats Theoretical Computer Science Physics Chemistry Biology Computer Science Philosophy more 3. Meta Stack Exchange Stack Apps Area 51 Stack Overflow Talent.

inserted by FC2 system