0

hi there im just new with java i just want to ask can 1 dialog box contain multiple lines i min like this one

JOptionPane.showMessageDialog (null,"\n "+EN ) ;

somehow i want to add just like

JOptionPane.showMessageDialog (null,"\n "+EN , "\n another messages here then" +DR , "\n and another messages again here then" +rd)) ;

those EN DR rd have their values to be calculated..
someone pls help..

6
Contributors
20
Replies
21
Views
5 Years
Discussion Span
Last Post by NormR1
Featured Replies
  • [code] JOptionPane.showMessageDialog(null,"Yahoo\nHotmail\nGmail"); [/code] :) , Also urs one is correct. Read More

0
"<html>  Some notice: <br>"
       + " - some text <br>"
       + " - some text <br>"
       + " - some text  </html>  "
1
JOptionPane.showMessageDialog(null,"Yahoo\nHotmail\nGmail");

:) , Also urs one is correct.

Edited by Majestics: n/a

0
JOptionPane.showMessageDialog(null,"Yahoo\nHotmail\nGmail");

:) , Also urs one is correct.

Hi there im quite confused.. i relly didnt get how to do that,, i only wanted to display several info in 1 dialog box.. im very new in java programming i only know how to display a simple dialog box..

0

Hi there im quite confused.. i relly didnt get how to do that,, i only wanted to display several info in 1 dialog box.. im very new in java programming i only know how to display a simple dialog box..

am by the way im using jcreator..

0
"<html>  Some notice: <br>"
       + " - some text <br>"
       + " - some text <br>"
       + " - some text  </html>  "

hello there am is this code used for dialog boxes in java i honestly dont know wer to put that code?

0

Did you try placing \n in the String where you want the new line to start?

hi there,, am yes i already done that one..

EN=100;
DR=20;

JOptionPane.showMessageDialog (null,"\nMY SALARY IS "+EN ) ;
so the output is

MY SALARY IS 100

somehow i want to do this
JOptionPane.showMessageDialog (null,"\nMY SALARY IS "+EN , "\n MY DEDUCTION is" +DR )

so my output in a single dialog box is

MY SALARY IS 100
MY DEDUCTION is 20

whats wrong with my code pls help..
im using jcreator..

0

Did you try placing \n in the String where you want the new line to start?

theres no problem bout the \n the problem is with those +EN when it shall display its value.. i just cant combine them..

0

i just cant combine them..

When you get errors, please copy and paste the full text of the message here.

Use the + operator to concatenate Strings:
"String1" + " stuff" + " more " ==> "String1 stuff more "
The compiler will convert some primitives to Strings for you:
"String " + 1 + " more " will give "String 1 more "

Edited by NormR1: n/a

-1
JOptionPane.showMessageDialog (null,"\nMY SALARY IS "+EN + "\n MY DEDUCTION is" +DR );

Edited by harinath_2007: semicolon

Votes + Comments
Don't spoonfeed, let the OP work it out.
0

When you get errors, please copy and paste the full text of the message here.

Use the + operator to concatenate Strings:
"String1" + " stuff" + " more " ==> "String1 stuff more "
The compiler will convert some primitives to Strings for you:
"String " + 1 + " more " will give "String 1 more "

im sorry for late reply got problem with my connection but thanks a lot it works i have done it already while offline... Thanks a lot for helping,, this is a project for my java class to be submitted tomorrow,, i just had idea wat will be the output but dont have much knowledge about the code tnx for the help..

0

When you get errors, please copy and paste the full text of the message here.

Use the + operator to concatenate Strings:
"String1" + " stuff" + " more " ==> "String1 stuff more "
The compiler will convert some primitives to Strings for you:
"String " + 1 + " more " will give "String 1 more "

@NormR1 i realy get this on the minute you post it its just got bit problem on my connection i see that im wrong putting , instead i shud used + operator to display my stuff before having , to display the name of my msg box..

can i ask another question here or i shud post it on another thread w/c is i dont know how..

0

i ask another question here or i shud post it on another thread

Post the new question on another thread

0

@NormR1 i realy get this on the minute you post it its just got bit problem on my connection i see that im wrong putting , instead i shud used + operator to display my stuff before having , to display the name of my msg box..

can i ask another question here or i shud post it on another thread w/c is i dont know how..

i think im wrong with that, did i?

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.