• 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

Tally will not add up

 
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is the class which I am struggling with: SubChoicesPanel

There are other classes used which I'll put at the end. The class generates a CardLayout of JPanels. There are plus & minus buttons, as these are pressed the JLabel increments & decrements accordlingly. So far so good. The problem is that this panel then redraws another panel TillPanel and updates the tally accordingly. i.e. if the user selects bitter the JLabel incements 1 and the tally in BillPanel increases, the output isn't quite right. I think that my next step would be to make the arrays plus, minus etc into multiple arrays, this would help accesing them.
I am aware that this is a long piece of code & understand people not wanting to get involved in it. It might be easier to just run it to see what I mean.
Here are the other classes:
BillTill

ChoicePanel:

TillPanel:

Any constructive advice would be gratefully received.
Thanks, Dave.
 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to run this program to see the output. I put all the .java files into a directory ( say c:\myWork\javaRanch ) and tried to compile them. I started with the TillPanel, as that has no dependancies. Then I tried SubChoicesPanel, but it wouldn't compile. It can't find the TillPanel class. What am I doing wrong? Anyone?
Oh. I am using JBuilder as my IDE...I added these 4 .java files to a blank project. Why can't classes see eachother?
 
Dave Johnson
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure why you can't get running.
I wrote them in this order: 1. BarTill, 2. ChoicePanel, 3. SubChoicesPanel 4. TillPanel.
But as Bartill has the main method(), that will have to be run.
Hope that helps, Dave.
 
reply
    Bookmark Topic Watch Topic
  • New Topic