For some reason, JOptionPane.showOptionDialog does not accept \n on runtime. It aknowledges it by not displaying "\n" or giving any errors but it also does not create a new line for the text. I cannot use a text block as it is stored to an array. I don't understand how it happened but this is a very strange bug. To my knowledge, "\n" creates a new line that any text afterwards will be outputted there.
int intReportOption = 0;
String[] strReportOptions =
{
"Show tasks\nthat are done",
"Show longest\ntask",
"Search for task\nby task name",
"Search for task by\nassigned person",
"Delete\ntask",
"Show\nreport",
"Exit"
};
while (intReportOption != 6)
{
intReportOption = JOptionPane.showOptionDialog(null,
"Pick an option",
"EasyKanban",
JOptionPane.DEFAULT_OPTION,
JOptionPane.QUESTION_MESSAGE,
null,
strReportOptions,
strReportOptions[0]);
}
Most searches on google say to use "\n" with some giving html syntax(for java?) which means my problem is special or stupid. Any help/suggestions would be greatly appreciated.
task"`) | also [How to add a multi line text to a JButton with the line unknown? (dynamically)](https://stackoverflow.com/questions/15746970/how-to-add-a-multi-line-text-to-a-jbutton-with-the-line-unknown-dynamically) – user16320675 Jun 16 '23 at 16:07