Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

parallel array and applets

 
Gina Ruffolo-Daniel
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • 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
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • 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
  • 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: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the actionPerformed method ever called? Is the "source == perGuest" condition ever true?
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
The values in the container don't change.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
I apologize..I thought I had posted it in my orginial posting.. here it is



Gina
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic