This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Svelte and Sapper in Action and have Mark Volkmann on-line!
See this thread for details.
Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

values changed, math didnt.

Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
Posts: 43016
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic