I finally got it to work - a little reading and experimenting is good for the mind. Thanks for the help! Following is the code I got to work. The btnCount adds two to the text field and exits at 12 and the btnCount2 subtracts one from the same text field and exits at 0.
Obviously I am a true green horn on java. I am off to a funeral for a good friend and I will spend tomorrow reading a few chapters in my book so I can get a better handle on the logic I need to use when using strings. I have had html, xml and xhtml classes and now I am trying to tackel java. I will solve this issue and send you my results - I appreciate you patients and help. As far as the boolean code I misread the last post Maneesh - I thought they were telling me to us a boolean to solve the problem. My mistake! Thanks again for all your help. Don
Pete - I am still struggling with this code. I hope I paste this right. When I run my program the buttons and text field show up in my gui frame and when I push either button the frame exits. If I change the boolean to true the same thing happens.
Maneesh & Pete
Thanks for the replies - sorry if I caused any confusion or problems - I think when you are frustrated with coding the brain cells are on over load. I think the Java Ranch is great and I will take the time to read the rule of the road when using the forums. In the future I will keep the posts short and to the point and use the [code] tags. Again thanks for your help - I hope I am in a position to help someone else down the road when I feel I can. Don
Thanks for the information I will work with it this weekend and see if I can get it to work. I'm not sure what you meant about the tags you added to my code - I could not see any changes to the code I sent you. This Java is a challenge and I hope I am up to the challenge. the project seems simply to click one button and add 2 and then click the other button and subtract one from the same text field. Of course it is easier said then done. Thank you for all you help.
I am new to Java Scripting and I am trying to write some code or if statement for the following. I have 2 JButtons (one labeled btnAddTwo and one lableled btnSubOne) and one text field.I am trying to get the btnAddTwo to add 2 when I click it and the btnSubOne to subtract one from the total in the text field. I built my program in netbean as a gui frame. Everthing works except for my counting. Any help I can get would be great - I am also new to the Bis Moose.