0

I am planning to make a maths game there will be one question like 1+ 1 as an image in Javafx. The textbox provided will give the user to input the number how do for example for 1+1 just allow the user to put in 2 and for everything else it will not accept then number in the text box. and display a message try again or something similar.

Basicly how do I restrict the text box for a specific number

  • Please show your effort. What you have tried? – Uluk Biy Jul 20 '15 at 12:53
  • thats the idea i have in my mind so have not really done it – Haroon Iqbal Jul 20 '15 at 13:13
  • So why not to start coding that logic, and if you will have difficulties update your question accordingly. – Uluk Biy Jul 20 '15 at 13:31
  • is it possible to contact you directly i can explain it fully to you if you don't mind? – Haroon Iqbal Jul 20 '15 at 13:33
  • Sorry I am going away from my laptop. Besides this, I totally understood your problem. Simply add key event filter listener to textfield's text property and accept only the "2". And another way is to use textfield's filtering feature, you need a modified version of [this example](http://stackoverflow.com/a/31043122) – Uluk Biy Jul 20 '15 at 13:49

0 Answers0