Solved

JOptionPane Text Display Question

Posted on 2002-07-10
4
210 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
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…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
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:

724 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