469,292 Members | 1,417 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,292 developers. It's quick & easy.

Tabs in JOptionPane window

Example

String testString = "Testing \t tabs";

JOptionPane.showMessageDialog(null, testString, "TEST",
JOptionPane.INFORMATION_MESSAGE);
Instead of getting the output "Testing tabs", I get something more like
"Testing | tabs" (although it isn't a pipe symbol, it's something unusual).

What do you need to do to get tabs to work with JOptionPane windows?
Jul 17 '05 #1
3 11997
SPG
I think you have to use a JLabel or JTextField to do this:

JOptionPane.showMessageDialog(null, new JLabel(testString), "TEST",
JOptionPane.INFORMATION_MESSAGE);
"- Steve -" <se****@foundation.sdsu.edu> wrote in message
news:1yGmb.29102$B_2.26152@okepread02...
Example

String testString = "Testing \t tabs";

JOptionPane.showMessageDialog(null, testString, "TEST",
JOptionPane.INFORMATION_MESSAGE);
Instead of getting the output "Testing tabs", I get something more like
"Testing | tabs" (although it isn't a pipe symbol, it's something unusual).
What do you need to do to get tabs to work with JOptionPane windows?

Jul 17 '05 #2
Unfortantley that doesn't change the tab behavior and eliminated the
functionality of the \n (everything is now on one line)

Steve
"SPG" <st************@nopoo.blueyonder.co.uk> wrote in message
news:bN*********************@news-text.cableinet.net...
I think you have to use a JLabel or JTextField to do this:

JOptionPane.showMessageDialog(null, new JLabel(testString), "TEST",
JOptionPane.INFORMATION_MESSAGE);
"- Steve -" <se****@foundation.sdsu.edu> wrote in message
news:1yGmb.29102$B_2.26152@okepread02...
Example

String testString = "Testing \t tabs";

JOptionPane.showMessageDialog(null, testString, "TEST",
JOptionPane.INFORMATION_MESSAGE);
Instead of getting the output "Testing tabs", I get something more like "Testing | tabs" (although it isn't a pipe symbol, it's something

unusual).

What do you need to do to get tabs to work with JOptionPane windows?


Jul 17 '05 #3
SPG
OK,

Try passing the text as HTML. IE Wrapping some tags around it. That worked
for us by accident when we were reporting errors from an HTTP post once.

If not, then use a JTextField or JTextArea, setting no border and the
bgcolor the same as the dialog, and editable = false. These can handle tabs
for sure!

Steve
"- Steve -" <se****@foundation.sdsu.edu> wrote in message
news:T22nb.36399$B_2.25477@okepread02...
Unfortantley that doesn't change the tab behavior and eliminated the
functionality of the \n (everything is now on one line)

Steve
"SPG" <st************@nopoo.blueyonder.co.uk> wrote in message
news:bN*********************@news-text.cableinet.net...
I think you have to use a JLabel or JTextField to do this:

JOptionPane.showMessageDialog(null, new JLabel(testString), "TEST",
JOptionPane.INFORMATION_MESSAGE);
"- Steve -" <se****@foundation.sdsu.edu> wrote in message
news:1yGmb.29102$B_2.26152@okepread02...
Example

String testString = "Testing \t tabs";

JOptionPane.showMessageDialog(null, testString, "TEST",
JOptionPane.INFORMATION_MESSAGE);
Instead of getting the output "Testing tabs", I get something more like "Testing | tabs" (although it isn't a pipe symbol, it's something

unusual).

What do you need to do to get tabs to work with JOptionPane windows?



Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by jazzy | last post: by
3 posts views Thread by tnhoe | last post: by
2 posts views Thread by jek339 | last post: by
1 post views Thread by Smarteric | last post: by
5 posts views Thread by Ramola | last post: by
7 posts views Thread by Andrew Poulos | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by harlem98 | last post: by
1 post views Thread by Geralt96 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.