Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: JOptionPane display on seperate lines

  1. #1
    Junior Member
    Join Date
    Oct 2011
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default JOptionPane display on seperate lines

    Hi everyone,
    I am trying to display an output message using JOptionPane. I want to display the message on a number of lines. I have tried numerous ways and can't seem to find a solution. If anyone could give me a simple example or provide a link to where I could find a solution, it would be greatly appreciated.

    Here's an example of what i'm trying to do;

    import javax.swing.JOptionPane;
    public class NewLine
    {
    public static void main(String[] args)
    {
    JOptionPane.showMessgeDialog(null, "hello")/n
    ("my name is: ")/n
    ("xxxx");
    System.exit(0);
    }
    }

    Thanks in advance.


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    22,286
    Thanks
    56
    Thanked 2,372 Times in 2,343 Posts

    Default Re: JOptionPane display on seperate lines

    What happens if you put all of the message you want to display within one pair of "s? I see 3 pairs of "s in your code.

Similar Threads

  1. opening a new jframe using a seperate file
    By bigblondguy in forum AWT / Java Swing
    Replies: 2
    Last Post: November 6th, 2011, 07:16 AM
  2. How to seperate several messages in a byte buffer
    By perl0101 in forum Java Networking
    Replies: 4
    Last Post: April 12th, 2011, 06:29 PM
  3. Switching between frames from a seperate class
    By kurt-hardy in forum AWT / Java Swing
    Replies: 4
    Last Post: February 14th, 2011, 04:19 AM
  4. Display in JOptionPane
    By t-rank in forum What's Wrong With My Code?
    Replies: 4
    Last Post: October 19th, 2010, 01:09 AM
  5. JOptionPane using If and Else
    By Liuric in forum Member Introductions
    Replies: 7
    Last Post: October 1st, 2010, 01:05 AM