Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

Tally will not add up

 
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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.
 
The world's cheapest jedi mind trick: "Aw c'mon, why not read this tiny ad?"
create, convert, edit or print DOC and DOCX in Java
https://products.aspose.com/words/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!