• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 217
  • Last Modified:

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);

0
prain
Asked:
prain
  • 2
1 Solution
 
OviCommented:
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

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now