By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,032 Members | 825 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,032 IT Pros & Developers. It's quick & easy.

Tabs in JOptionPane window

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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.