Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

making the message wrap in a JDialog

 
Randall Twede
Ranch Hand
Posts: 4439
3
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
set it as the text of a JTextArea (in scrollPane) with lineWrap set to true
 
Randall Twede
Ranch Hand
Posts: 4439
3
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4439
3
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well it's ugly but it works
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I still think it's simpler with a textArea.
Run this to see what it looks like.



 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic