0

I am using JTextArea to collect input for steps of recipe instructions. The input text example:

1. STEP ONE
2. STEP TWO
3. STEP THREE

when i print the output into console, it successfully prints it with all the newlines, as follows (same as before):

1. STEP ONE
2. STEP TWO
3. STEP THREE

however, the moment i put the text from JTextArea into a JLabel component, the text displays on a single line:

1. STEP ONE2. STEP TWO3. STEP THREE

Is there some workaround for this? I know that usually JLabel is used with HTML tags to handle multilines using the <br> tag, but since the input is separated with \n newline characters, there seems to be no clean way of going around this. Any advice please?

jbly1309
  • 31
  • 4

0 Answers0