my dog learned polymorphism*
The moose likes Applets and the fly likes parallel array and applets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "parallel array and applets" Watch "parallel array and applets" New topic
Author

parallel array and applets

Gina Ruffolo-Daniel
Greenhorn

Joined: Oct 01, 2005
Posts: 19
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
Marshal

Joined: Mar 22, 2005
Posts: 41042
    
  43
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.


Ping & DNS - my free Android networking tools app
Gina Ruffolo-Daniel
Greenhorn

Joined: Oct 01, 2005
Posts: 19
It doesn't update the per guest cost or event cost when the user changes the guest count.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41042
    
  43
Is the actionPerformed method ever called? Is the "source == perGuest" condition ever true?
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

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?


[Jess in Action][AskingGoodQuestions]
Gina Ruffolo-Daniel
Greenhorn

Joined: Oct 01, 2005
Posts: 19
The values in the container don't change.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

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

Joined: Oct 01, 2005
Posts: 19
I apologize..I thought I had posted it in my orginial posting.. here it is



Gina
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: parallel array and applets
 
Similar Threads
pen problems
JApplet
appletviewer
Help with screen output in applet
How to get these two classes to interact?