Hi everyone, I've made a calculator that calculates the amount of calories burned during a workout, and body mass index. Most of the calculations work well, however, when the user changes their body weight, the calories burned calculation doesn't change. The JButtons I am using work fine the first time, however if you go back and change the weight value you input after the first calculation, the calculation doesn't change. Any help would be greatly appreciated as this is due very soon. Thank you very much.
[ UD: edited to break long lines into two for better formatting ] [ April 25, 2007: Message edited by: Ulf Dittmer ]
posted 9 years ago
The variable 'amount' (where you indicate the problem is) only depends on the type of exercise and the length, not body weight and height, so it's not surprising that it doesn't change. The value of the weight shown in the line above that should change if the button is clicked, though.
As an aside, what are the ActionListeners supposed to do that are attached to the TextFields? It seems that all actions are handled by the buttons (which is a more intuitive way to do it, too).
Since, there is nothing applet-specific in this question, I'm moving it the AWT/Swing forum.