i have 3 JTextFields A, B and C. these textfields require integer values to be entered.what i want to do is when a value is entered in textfield A and textfield B i want to automatically calculate the sum of the two values entered and display this value in textfield c. can i do this?? how??
You would create one TextListener and add it to the first two textfields. In the textValueChanged() method of the TextListener you would get the values from the first two textfields and attempt to cast them into numbers and add them, putting the result in the third text field. If the class that contains the three textfields implements TextListener, or uses an inner class, then you automatically have the references to the textfields. If you use a separate class, you'll have to pass references to the textfields into your TextListener class.
Write once, run anywhere, because there's nowhere to hide! - /. A.C.