Solved

JOptionPane Text Display Question

Posted on 2002-07-10
4
207 Views
Last Modified: 2010-03-31
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
Comment
Question by:prain
  • 2
4 Comments
 
LVL 9

Accepted Solution

by:
Ovi earned 50 total points
ID: 7145289
Try with html code instead of plain text.

String tab = "&nbsp&nbsp&nbsp&nbsp";
String testString = "<html>Hello " + tab + " My Friend</html>";
0
 
LVL 3

Expert Comment

by:yasser_helmy
ID: 7145704
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
 
LVL 9

Expert Comment

by:Ovi
ID: 7145791
No reason, perhaps only because html code offers a variety of possibilities in formating the text.
0
 
LVL 35

Expert Comment

by:girionis
ID: 8917119
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

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
JUnit 4 @Before and @BeforeClass differences 3 60
runtime exception 2 30
maven module vs maven project 3 23
Adding multiple JVM environments to RedHat 6 7 24
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question