Solved

JOptionPane Text Display Question

Posted on 2002-07-10
4
205 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 Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how do i compare an object based on two fields 6 49
rhino JavaScript import, load 25 67
even odd program using while loop 3 29
javap not working 8 37
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

920 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now