472,343 Members | 2,578 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,343 software developers and data experts.

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 12621
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: jazzy | last post by:
Hi, I am new to Java Programming and I am trying to write code using JOption pane to prompt user to type information and then have string output...
3
by: tnhoe | last post by:
Hi, I would like to set focus to a field in a form inside a tab page. It is a multiple tabs under different divisions (eg: sc1,sc2,sc3,etc) ...
2
by: jek339 | last post by:
Hey, I'm totally new to Java, and I'm taking a class. My current assignment involves inputting 2 names and corresponding bdays for each name using...
6
by: Stephen Edwards | last post by:
I am a novice, so bear with me. I designed a website using CSS TABS, all was fine, then I copy and pasted meta name, etc for keywords, tweaking it...
3
by: majorecono | last post by:
What I'm bad at is the dialog box part. This is the code Ive come up with... if you see a way to improve what im thinkng of.... post it please. ...
1
by: Smarteric | last post by:
import javax.swing.JOptionPane; public class MilesPerGallon { public static void main(String args) { String miles; String gallons; double MPG;...
5
by: Ramola | last post by:
hi, I was wondering if i can customise a JOptionPane ??? ex : A JOptionPane by default has a background color gray............. can i change it...
3
by: heat84 | last post by:
I want to customise JOptionPane and add a KeyListener to it. I want to behave in a certain manner when the enter key is pressed , but from the look...
7
by: Andrew Poulos | last post by:
Is there a way for javascript to know if a browser has been set to open new windows in tabs? I'm trying to fix some code that allows a user to...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.