• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

parallel array and applets

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Newbie: I am trying to create an applet that allows a user to enter the number of guest and display the per person price or total cost (number of guest * price). The user should be allowed to change the number of guest without exiting the application. I know that it is a loop. Please see the code below


the program does compile and run



Thank you in advance,
Gina
 
Rancher
Posts: 43027
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the program compiles and runs, then what is the problem? Does it not do what you expect it to do? Then you should describe how the expected behavior differs from the observed bahavior.
 
Gina Ruffolo-Daniel
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It doesn't update the per guest cost or event cost when the user changes the guest count.
 
Ulf Dittmer
Rancher
Posts: 43027
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is the actionPerformed method ever called? Is the "source == perGuest" condition ever true?
 
author and iconoclast
Posts: 24204
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Gina Ruffolo-Daniel:
It doesn't update the per guest cost or event cost when the user changes the guest count.



How do you know that? How is guestPrice displayed to the user?
 
Gina Ruffolo-Daniel
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The values in the container don't change.
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24204
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, that's what you said. But in any case, there is no code above that shows how guestPrice is displayed to the user, so if the problem is in fact with that part of the program -- especially the part that actually arranges for the new value to be displayed -- then you'll have to actually show us that part of the code ro we can't help you with it.

In general, changing the value of an int member variable will have absolutely no effect on any GUI display. Some code, somewhere, would have to deliberately do something to display the new value -- and you're not showing us any code that does anything like that.
 
Gina Ruffolo-Daniel
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I apologize..I thought I had posted it in my orginial posting.. here it is



Gina
 
Listen. That's my theme music. That's how I know I'm a super hero. That, and this tiny ad told me:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic