Top of the day to you guys out there! Kindly assist in this program.It's made up of six textfields and a button on a should work in such a way that the fifth textfield displays the sum of the values entered into the first four on pressing the button.Also,the display of the sixth textfield should be dependent on the value returned by the fifth at the press of the button.

Thanks a trillion,

Recommended Answers

All 2 Replies

Lets give it a try :

Button.addActionListener( new java.awt.event.ActionListener(){
public void actionPerformed(ActionEvent e){

//convert fields into integers
int a = Integer.ParseInt(TextField1);
int b = Integer.ParseInt(TextField2);
int c = Integer.ParseInt(TextField3);
int d = Integer.ParseInt(TextField4);

//adding all numbers
int e = a + b + c + d;

//displaying the result in TextField5

This sample code will help you .... build the app now.

Dear Nanosani,
Peace of the LORD be yours,thanks a trillion for that rescue,The code snippets you provided work perfectly well.

Take very good care of yourself and keep enjoying.


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.