How to align multiple lines of JOptionPane output dialog messages by “:”?

I need to make the output in 3 lines and also aligned by “:”, using JOptionPane.showdialogmessage(): *note the alignment of the “:” Total cost : $11175.00 Number of units …

Condition to point out Error in line formatting not being met

I have a program which reads a file and enforces a certain format in every line. If a line has a format error, it prints a line below it indicating which error it was. For each line, From column 1 to …