0

so I'm trying to add a new line on my JLabel to show all the car loan amortization schedule and for some reason, the "\n" doesn't work. Here's the code:

for (int i = 1; i <= newYears; i++) {
            interest = newRate2 * amount;
            principal = monthlyPayment - interest;
            amount = amount - principal;
            //console
            System.out.println(i + "\t\t" + df.format(principal) + "\t\t" + df.format(interest) + "\t\t" + df.format(amount));
            //Second Frame where i want to show the full amortization schedule
            second.jlsPayment2.setText("" + i + "                                " + df.format(principal) + "                     " + df.format(interest) + "                        \n" + df.format(amount));
        }

any help is greatly appreciated, thanks

Jek
  • 3
  • 2
  • Did you see that: https://stackoverflow.com/questions/1090098/newline-in-jlabel ? – Matt Mar 27 '18 at 22:52
  • Wrap the text in HTML, for [example](https://stackoverflow.com/questions/12008100/formatting-text-in-jdialog-box/12008603#12008603) – MadProgrammer Mar 27 '18 at 22:52
  • I did not see that. thanks for linking it and yea I ended up using String builder and append and now I just need formatting. Thanks – Jek Mar 28 '18 at 00:34

0 Answers0