473,508 Members | 2,374 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 12831
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
4836
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 command to display information on the screen. I...
3
2645
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) <div name='sc1'> <form name='form1'> <input...
2
3039
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 the JOptionPane.showInputDialog etc. Anyway, I'm...
6
1762
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 where necessary for keywords. I did not notice...
3
5042
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. Program should.... 1. Ask user to type in a...
1
2111
by: Smarteric | last post by:
import javax.swing.JOptionPane; public class MilesPerGallon { public static void main(String args) { String miles; String gallons; double MPG; double miles1, gallons1;
5
4529
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 ?? can i put some images in the background ? Its...
3
7440
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 of things, the key listener I am adding to the...
7
2999
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 close a window that javascript opened and it seems to...
0
7224
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7120
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7380
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7039
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5626
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5050
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3192
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
763
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
415
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.