JOptionPane Text Display Question

Ok. I am displaying a simple text string with tab characters on a JOptionPane MessageDialog. But when displays the string, it displays a square instead of tabbing.

Any ideas how to overcome this problem.?


String testString = "Hello \t My Freind";

JOptionPane.ShowMessageDialog(null, testString, "Any Title", JOptionPane.PLAIN_MESSAGE);

prainAsked:
Who is Participating?
 
OviConnect With a Mentor Commented:
Try with html code instead of plain text.

String tab = "&nbsp&nbsp&nbsp&nbsp";
String testString = "<html>Hello " + tab + " My Friend</html>";
0
 
yasser_helmyCommented:
hi ovi,
if there is no other way except to put the spaces, why dont we put it directly instead of html code.
String testString="Hello   Friend";
0
 
OviCommented:
No reason, perhaps only because html code offers a variety of possibilities in formating the text.
0
 
girionisCommented:
No comment has been added lately, so it's time to clean up this TA.

I will leave a recommendation in the Cleanup topic area that this question is:

- points to Ovi

Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

girionis
Cleanup Volunteer
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.