so i have a solution (a bad one) to split a line within a table's cell - keeping the length of the JOptionPane to what i want it to be and allowing for text to be on multiple lines within a cell. Also if it becomes vertically too long, a scroll bar appears.
currently i have a loop
which displays 9 words on a line until there are no more words left in the string
. i'm also using setText( with 100% width)
I tried this. It seemed to work. Trial and error make me come up with this 289px width. You will still have to do something similar to what you are currently doing if you have words that are really long like this: reallyreallyreallyreallyreallyraellyreallylong
My solution is below:
setText("<html><table style='width:100%'>" + "<tr><td style=\"width:289px;\"><b>" + value + "</b></td></tr>" + "<tr><td style='font-weight:normal;font-size:11;padding-top:-50px;margin-top:-5px;'><i>" + "this is going to have to be pretty long actually" + "</i></td></tr>" + "</table>");
Is this something like what you were looking for?