Author
making the message wrap in a JDialog
Randall Twede
Ranch Hand
Joined: Oct 21, 2000
Posts: 4092
i have the following code which works ok except the message doesn't wrap, so the JDialog (the lucky recipient of the return value from getMessage()), is one long...long...long..line
can i perhaps set the width of the JDialog ?
SCJP
Michael Dunn
Ranch Hand
Joined: Jun 09, 2003
Posts: 4632
posted Apr 19, 2012 20:00:00
0
set it as the text of a JTextArea (in scrollPane) with lineWrap set to true
Randall Twede
Ranch Hand
Joined: Oct 21, 2000
Posts: 4092
it is one of several classes that implement the same interface. the main program treats them all the same using a JDialog to display the message
i suppose i could add some newline characters, but after what i had to do to turn it into a string in the first place
Randall Twede
Ranch Hand
Joined: Oct 21, 2000
Posts: 4092
well it's ugly but it works
Michael Dunn
Ranch Hand
Joined: Jun 09, 2003
Posts: 4632
posted Apr 20, 2012 19:58:11
0
I still think it's simpler with a textArea.
Run this to see what it looks like.
subject: making the message wrap in a JDialog