• Post Reply Bookmark Topic Watch Topic
  • New Topic

automatically update score when user input in JTextField..  RSS feed

 
ethaniel landfough
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I also post my problem in dreamincode.net. I have 9 x 9 grid of JTextField(which colored black & white). Whenever user input in the white colored JTextField, it will automatically update the score which i make with JLabel. If the input is right /equals the real answer then score = score + 1. I attach keyListener to the JTextField grid, i also restrict the input to only letter character + backspace. My problem is : when i first input the answer(and its right answer), the score wouldn't add untill input in the next grid it will show score = 1; So, when i input into 8 grid (all of it were right), i only get score = 7 not score = 8;

I tried with key released and it works ( score =8) but i can't use *.consume(); which make me can't restrict the user input.. Thanks.

 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> I also post my problem in dreamincode.net.

please provide the link, so we can see what has already been suggested.
 
ethaniel landfough
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael Dunn wrote:> I also post my problem in dreamincode.net.

please provide the link, so we can see what has already been suggested.


Oh... sorry and sorry again for everyone who have read this post..Because i have found out how to solve my problem and thank's..
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
still post the link.

anyone searching here can get the solution via the link
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!