Out of ideas

A friend asked me if I could help debug her code(blind leading the blind), I got it down to two erros, can you fix this for us. The error is "}"expecting , I did what I can so far , you know the easy errors missing semie colons and such, but I am out of ideas, thank you...

// build the first layout panel and add label
JPanel File1 = new JPanel();
JLabel lblLoanAmount = new JLabel("Type the loan amount here",
JLabel.CENTER); // center the label and set the text field to 10 char length
JTextField txtLoanAmount = new JTextField(10);

// build the second layout panel and add label
JPanel File2 = new JPanel();
JLabel lblIntRate = new JLabel("Type the interest rate here",
JLabel.CENTER); // center the label and set the text field to 10 char length
JTextField txtIntRate = new JTextField(10);

// build the third layout panel and add label
JPanel File3 = new JPanel();
JLabel lblTerm = new JLabel("Type the loan term here",
JLabel.CENTER); // center the label and set the text field to 10 char length
JTextField txtTerm = new JTextField(10);

// build the first layout panel and add label
JPanel File1 = new JPanel();
lblLoanAmount = new JLabel("Type the loan amount here",
JLabel.CENTER); // center the label and set the text field to 10 char length
JTextField txtLoanAmount = new JTextField(10);

// build the second layout panel and add label
JPanel File2 = new JPanel();
lblIntRate = new JLabel("Type the interest rate here",
JLabel.CENTER); // center the label and set the text field to 10 char length
JTextField txtIntRate = new JTextField(10);

// build the third layout panel and add label
JPanel File3 = new JPanel();
lblTerm = new JLabel("Type the loan term here",
JLabel.CENTER); // center the label and set the text field to 10 char length
JTextField txtTerm = new JTextField(10);

>>, SADProgram3Event class class must be defined before use; I overlooked that sorry, fixed it, also added "}" at the end and commented the extra JButtons out, now six errors, am I close to fixxing this, I hope?

// build the first layout panel and add label
JPanel File1 = new JPanel();
JLabel lblLoanAmount = new JLabel("Type the loan amount here",
JLabel.CENTER); // center the label and set the text field to 10 char length
JTextField txtLoanAmount = new JTextField(10);

// build the second layout panel and add label
JPanel File2 = new JPanel();
JLabel lblIntRate = new JLabel("Type the interest rate here",
JLabel.CENTER); // center the label and set the text field to 10 char length
JTextField txtIntRate = new JTextField(10);

// build the third layout panel and add label
JPanel File3 = new JPanel();
JLabel lblTerm = new JLabel("Type the loan term here",
JLabel.CENTER); // center the label and set the text field to 10 char length
JTextField txtTerm = new JTextField(10);

Thank you That helped all the errors are telling me that can't find symbol, I fixed the class problem I thought, yet why cannot the programe recognize the class on such lines as>> Container pane = getContentPane();and>> lblPayment.setEditable(false);
I must be missing something very fundumental

give the code I posted above a try. things that I have changed:
1)
The labels are used by more than one functions, so they can not be local to the constructor; declare them at the top of the class and
JLabel lblLoanAmount;
JLabel lblIntRate;
JLabel lblTerm;
JLabel lblPayment;

2)
removed the virtual keyword, it makes no sense why you used it at places.

3)
in CalculateMortgage() function
changed LoanAmount to lblLoanAmount (similiarly for others) where required.
you don't want to call setText on LoanAmount variable, rather on the corresponding label.

For code to compile, I had to comment out the Event listener because the SADProgram3Event class is not available. The program does need some debugging though.
5)
use
getRootPane().getContentPane();
instead of getContentPane();

6)
there is no function called setEditable for JLabel, labels are not editable anyways, just comment that out.
lblPayment.setEditable(false);

0

charliebabyAuthor Commented: 2006-11-19

I tell you what this a lot for a newbe lik me,( also I getting burnt out ) I want to help her , she hasen't had working code in five weeks now, so of course I feel bad for her, I am going to send her your improved code along with your recommendations, and let her make the corrections if she has time (I am sure she does her code in between raising a family, and thats tricky) , before I close this question any more advice for her(and me), Thank you so much suprapto45, and thank you David. Charlie

0

charliebabyAuthor Commented: 2006-11-19

Sorry I ment to thank you avsrivastava, I can't see straight right now sorry for that thank you again AVSRIVASTAVA!!!!

>>"before I close this question any more advice for her(and me)"
In my opinion, you are doing it in the right way and direction (for you) but not for her. I am not sure whether she will have a look at the codes and tries to understand it or not. However, I saw that you were struggling with the codes, you practiced, you tried and you know what, practice will make you better and better programmer. All of your questions are the same questions that I asked when I first learned Java.

So, please keep learning and try to move to J2EE which is the most popular technology today ;) but be careful, it is complex.

// build the first layout panel and add label
JPanel File1 = new JPanel();
lblLoanAmount = new JLabel("Type the loan amount here",
JLabel.CENTER); // center the label and set the text field to 10 char length
JTextField txtLoanAmount = new JTextField(10);

// build the second layout panel and add label
JPanel File2 = new JPanel();
lblIntRate = new JLabel("Type the interest rate here",
JLabel.CENTER); // center the label and set the text field to 10 char length
JTextField txtIntRate = new JTextField(10);

// build the third layout panel and add label
JPanel File3 = new JPanel();
lblTerm = new JLabel("Type the loan term here",
JLabel.CENTER); // center the label and set the text field to 10 char length
JTextField txtTerm = new JTextField(10);