incrementing in if statement

Reply

Join Date: Jan 2009
Posts: 8
Reputation: mercury113 has a little shameless behaviour in the past 
Solved Threads: 0
mercury113 mercury113 is offline Offline
Newbie Poster

incrementing in if statement

 
0
  #1
Jan 12th, 2009
		if(e.getSource() == choice2) {
			if(choice2.getSelectedItem().equals("Monitor"))   {
				choice2.setBackground(Color.GREEN);
                                hidebutton++
				score++;

						}
				else	{
				choice2.setBackground(Color.RED);
				}
				choice2.setEnabled(false);
				}

i have this code here...
why do when i apply this method the score is
incremented to??

would you plzz help me..

whAt is wrong 2 da Code...

4 example i have a button when i pressed it...

it must be the value of hide button and score is 1...

but in my code it shows that the score is 2 and the hide button is 1...

sorry 4 my bad english...
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 2,385
Reputation: masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of 
Solved Threads: 252
Moderator
masijade's Avatar
masijade masijade is offline Offline
Nearly a Posting Maven

Re: incrementing in if statement

 
0
  #2
Jan 12th, 2009
  1. hidebutton++
isn't that statement missing a ";"?
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 706
Reputation: stultuske is a jewel in the rough stultuske is a jewel in the rough stultuske is a jewel in the rough 
Solved Threads: 84
stultuske's Avatar
stultuske stultuske is offline Offline
Master Poster

Re: incrementing in if statement

 
0
  #3
Jan 12th, 2009
Originally Posted by mercury113 View Post

i have this code here...
why do when i apply this method the score is
incremented to??
because you coded it that way?

Originally Posted by mercury113 View Post
sorry 4 my bad english...
do understand that we don't mind you having difficulties with English, we do, however, mind if you don't even bother to try typing a decent English sentence, so the " 1 kn0w wh0 y0u 4r3 " way to write your messages is not really showing us you're a real l33t-you-have-to-be-helped-first person, it shows us you're a l4zy-n0t-w1ll1ng-t0-put-1n-3ff0rt person
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC