This site requires JavaScript, please enable it in your browser!
Greenfoot back
FelyFret
FelyFret wrote ...

2014/12/11

How to make a text box appear

FelyFret FelyFret

2014/12/11

#
Hi I'm making a game and i need a text box to appear. My "person" moves around the map and every time it touches an actor, I would like a question and a text box to appear. I am not that familiar with the JOption. How would I do this? Thanks
FelyFret FelyFret

2014/12/11

#
I also need the actor that is touched by my "person" to disappear, allowing the "person" to pass by it. My game is a maze, so the actor that disappears is essentially a obstacle the user will have to get by. Thanks
danpost danpost

2014/12/11

#
When you say 'a question and a text box', do you not mean 'a question and an input box'? or is the question to be in a text box and a single correct keystroke will be detected or something before allowed to continue on in the maze?
FelyFret FelyFret

2014/12/14

#
Yes, I mean a question and an input box. The user will the have to input something. And depending on if the answer is right or wrong, the user gets to pass Thanks
danpost danpost

2014/12/14

#
What kind of input is required to pass? or, give an example of one of the questions that could be prompted and an example of what would be entered by the user to pass (like, put the user response in quotes exactly how they might respond).
FelyFret FelyFret

2014/12/15

#
I'm doing an educational algebra game. For example, a question would pop up on the top of the screen:"Solve for X: 3x+7=16" the user would have to input "3" in order to pass. If the user answers it wrong, the game ends. Thanks
danpost danpost

2014/12/15

#
Ok. I guess that JOptionPane is the easiest way to go, then. The following line of code will set the variable 'guess' to the input of the user (of course, you will probably have the equation in another variable and not hard-coded as in the line given):
1
String guess = javax.swing.JOptionPane.showInputDialog("3x+7=16");
FelyFret FelyFret

2014/12/15

#
Okay thank you!
You need to login to post a reply.