View Full Version : Need help with GUI problem
EL_TYCHO
03-19-2010, 12:13 AM
Hi, I have to make a hangman script in Java, the console version was great, but now I have to get it in a gui version. Some things worked out and now I need help :(
The main problem is the game itself. Its in dutch so I hope everybody can understand it. So I need to get the game working in the gui. It may look as butt ugly as hell, I dont care, it just has to work :(
I added all my classes and wat I already have.
I ran the program, but it's all in Dutch :duh:, so I don't know how the program should or should not function...
What's the specific problem you're having?
Edit: Okay, I found teh problemz. In Spel.java, you have:
JOptionPane.showInputDialog(null,"Welke letter kies je?");
inp = input.nextLine();
Not good. It ignores the input from the dialog that opens and waits instead for command-line input. Quick and easy fix:
inp= JOptionPane.showInputDialog(null,"Welke letter kies je?");
//inp = input.nextLine(); You can remove this line; it's pretty useless...
I played a whole game. It's looking pretty nice. :)
EL_TYCHO
03-19-2010, 11:06 AM
Lol, that was it? Damn, I thought that was wrong but was not sure :D
Did you play a full game in console or in GUI? Because I think the "Hangman" is not drawn in the GUI version yet when you make a mistake
Tried it myself, but it still does nothing after he asks a letter :(
weequ
03-19-2010, 02:10 PM
I should try learning these guy things too. But I dont have the time atm :(
Lol, that was it? Damn, I thought that was wrong but was not sure :D
The showInputDialog method returns the user input, so you definitely need to store the value.
Did you play a full game in console or in GUI? Because I think the "Hangman" is not drawn in the GUI version yet when you make a mistake
The Hangman is drawn in the console. To make it draw onto the GUI, you could add an applet that draws a hangman, letters, and all that good stuff.
Tried it myself, but it still does nothing after he asks a letter :(
Worked for me, but it only draws the hangman after you guess a letter wrong, otherwise it reveals the correctly-guessed letters.
I guessed "A" and it was right:
http://www.imagenerd.com/uploads/guess-right-P1zDu.bmp
Then, I guessed a few more letters... all but one wrong:
http://www.imagenerd.com/uploads/guess-wrong-MyDWr.bmp
And then I lost (blame the Dutch :f:):
http://www.imagenerd.com/uploads/reveal-word-HJE8k.bmp
@anti: fuck time, learn this shit or I'mma beat ya face in
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.