473,572 Members | 3,074 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Tabs in JOptionPane window

Example

String testString = "Testing \t tabs";

JOptionPane.sho wMessageDialog( null, testString, "TEST",
JOptionPane.INF ORMATION_MESSAG E);
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 12842
SPG
I think you have to use a JLabel or JTextField to do this:

JOptionPane.sho wMessageDialog( null, new JLabel(testStri ng), "TEST",
JOptionPane.INF ORMATION_MESSAG E);
"- Steve -" <se****@foundat ion.sdsu.edu> wrote in message
news:1yGmb.2910 2$B_2.26152@oke pread02...
Example

String testString = "Testing \t tabs";

JOptionPane.sho wMessageDialog( null, testString, "TEST",
JOptionPane.INF ORMATION_MESSAG E);
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.blueyond er.co.uk> wrote in message
news:bN******** *************@n ews-text.cableinet. net...
I think you have to use a JLabel or JTextField to do this:

JOptionPane.sho wMessageDialog( null, new JLabel(testStri ng), "TEST",
JOptionPane.INF ORMATION_MESSAG E);
"- Steve -" <se****@foundat ion.sdsu.edu> wrote in message
news:1yGmb.2910 2$B_2.26152@oke pread02...
Example

String testString = "Testing \t tabs";

JOptionPane.sho wMessageDialog( null, testString, "TEST",
JOptionPane.INF ORMATION_MESSAG E);
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****@foundat ion.sdsu.edu> wrote in message
news:T22nb.3639 9$B_2.25477@oke pread02...
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.blueyond er.co.uk> wrote in message
news:bN******** *************@n ews-text.cableinet. net...
I think you have to use a JLabel or JTextField to do this:

JOptionPane.sho wMessageDialog( null, new JLabel(testStri ng), "TEST",
JOptionPane.INF ORMATION_MESSAG E);
"- Steve -" <se****@foundat ion.sdsu.edu> wrote in message
news:1yGmb.2910 2$B_2.26152@oke pread02...
Example

String testString = "Testing \t tabs";

JOptionPane.sho wMessageDialog( null, testString, "TEST",
JOptionPane.INF ORMATION_MESSAG E);
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
4841
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 am able to prompt for typing the information but the display does not work. Here is my sample code: **
3
2652
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 name='myfield'> </form> </div>
2
3043
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 confused by Sun's site and I keep getting error messages. Below is what I have and the error message when I try to compile. Any help would be much...
6
1764
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 any problems until I looked at the site and although the text for the tabs was showing up the images which make up the tabs weren't. I have no...
3
5049
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 sentence, using JOptionPane.showInputDialog(). 2. The program will scan each letter in the string and count how many times the upper case letter 'E'...
1
2118
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
4531
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 necessary coz............in my game i cant afford having a JOptionPane tht looks sad .........I want to be catchy !!! kind regards, Malavika
3
7447
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 JDialog is not working. The code is running and not giving errors but when it comes to printing the statements, when I press enter , nothing is happening...
7
3010
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 get confused what window to close when a new tab is opened. (The user clicks a link in the opened window which which opens a new window and close...
0
7733
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7957
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7705
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6337
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5524
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3685
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2138
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
975
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.