java.jpg
hello . can somebody help me how can I add the numbers in quantity where it will automatically put in total?
im using netbeans.
just want the codes for how to add the listed quantity? hope you can help me
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
java.jpg
hello . can somebody help me how can I add the numbers in quantity where it will automatically put in total?
im using netbeans.
just want the codes for how to add the listed quantity? hope you can help me
What have you tried?
If you don't understand my answer, don't ignore it, ask a question.
i tried thisjLabel8.setText(String.valueOf(Double.parseDouble( txtQuantity.getText()) + Double.parseDouble(txtQuantity.getText())));
What was the results?
If you don't understand my answer, don't ignore it, ask a question.
i tried thisbut the Amount keeps changing into the quantity im putting it must be the sum of quantityif(txtQuantity.getText().equals("")){
txtAmount.setText("");
}
else {
txtAmount.setText(String.valueOf(Double.parseDoubl e(txtQuantity.getText()) * 250));
--- Update ---
it should be like this . First, I will put quantity: 12 then the amount will be 250 * 12 = 3000 , but when i change it in any number example 124 the amount change but total must be 124 + 12 = 136 so i want it like that hope you understand my grammar is not good
If you want the total to be updated every time one of the values used to compute the total is changed, you will need to use a listener that can detect the change and recompute the total after the change is made.
If you don't understand my answer, don't ignore it, ask a question.
hmmm.
what i mean is every time i input quantity it will keep adding and getting the sum. so that i can use that total in exchange for txtAmount.setText(String.valueOf(Double.parseDoubl e(*txtQuantity--this should be replace by the TotalQty*.getText()) * 250));
Can you make a small, simple program that compiles, executes and shows the problem?
If you don't understand my answer, don't ignore it, ask a question.