• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

values changed, math didnt.

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
ken zemaitis
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Figured it out, nevermind!
 
Roses are red, violets are blue. Some poems rhyme and some don't. And some poems are a tiny ad.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic