delphi programming forums mysql charset mget recursive synonimos
free ventrilo servers hosting cs javascript delay python find in list
Back Forum New
abstract:


Code:
if (e.getSource() == btnPay){
int sum  = 0;
for (int i=0; i < pickedCars.length; i++){
     sum = (int)(sum+pickedCars.getValue());                      txfTotalPrice.setText(" " + sum);
     }
   



   I am trying to write a simple shopping cart but I need some help in coding the payment button, which should display the SUM value of the items listed in array.The program is compiling but I am getting some errors msgs at the console like these:  at java.awt.EventDispatchThread.pumpEventsForHierarch y(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source)
Code:
  1. if (e.getSource() == btnPay){
  2. int sum  = 0;
  3. for (int i=0; i < pickedCars.length; i++){
  4.      sum = (int)(sum+pickedCars[i].getValue());                      txfTotalPrice.setText(" " + sum);
  5.      }
  6.    
Copy Code

TOP


Originally Posted by makarov
Code:
  1. if (e.getSource() == btnPay){
  2. int sum  = 0;
  3. for (int i=0; i < pickedCars.length; i++){
  4.      sum = (int)(sum+pickedCars[i].getValue());                      txfTotalPrice.setText(" " + sum);
  5.      }
  6.    
Copy Code
Is your array null? Nothing a simple System.out.println( ... ) can't tell ... Are the other variables having sane values? Again, System.out.println( ... ) can be of help ...
kind regards,
Jos




Code:
if (e.getSource() == btnPay){
int sum  = 0;
for (int i=0; i < pickedCars.length; i++){
     sum = (int)(sum+pickedCars.getValue());                      txfTotalPrice.setText(" " + sum);
     }
   

TOP

Back Forum