• Post Reply Bookmark Topic Watch Topic
  • New Topic

have a problem rendering a text in JOptionpane + JTextArea  RSS feed

 
Ranganath Junpal
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am trying to render a text like this

JOptionPane.showMessageDialog(parent,getcomponent(errormsg), erromsg ,type , imageicon);
where component is a JScrollpane having a JTextArea within it.

There is a problem with this message rendering in the JTextArea.
say if the error message is some thing like this:-

cmd not found
prompt\>dir1 filename
^

In the JTextArea it is rendered as follows:-

cmd not found
prompt\>dir1 filename
^

Can some one please tell me what might be the problem. I tried using the JEditorPane and JTextPane instead of JTextArea. But the problem persists.

While debugging when i watch the string it is absolutely correct but when it is not rendering properly as i see in the string.

I even tried changing the fonts and font size as well. But all in vain.

Thanks a lot
Ranganath.S
 
Rob Spoor
Sheriff
Posts: 21052
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Next time UseCodeTags if you want to preserve the whitespace at the start.

Try setting the font of the text area to something monospaced like Courier New.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!