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 3 of 3

Thread: This shouldn't be too hard.

  1. #1
    Junior Member
    Join Date
    May 2013
    Posts
    13
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default This shouldn't be too hard.

    so yes, i listened to you guys and read through the whole API documentation for the JOptionPane.
    i found how to add components to it, Jrmonkey97 (or something) already told me to do it that way but i didn't listen..

    well i made an object like:
    label4 = new JLabel("Check this out");
    label5 = new JLable("I dont know how to add this label");
    object[] test = {label4, label5};
     
    JOptionPane.showMessageDialog(null, test[0], "Log in", JOptionPane.INFORMATION_MESSAGE);

    so YES i managed to add that label to the JOptionpane, my only question is: how do i add multiple labels/textfields/passwordfields to that optionpane, because in the API it says that you should be able to do:
    JOptionPane.showMessageDialog(null, test[0], test[1], "log in" , JOptionPane.INFORMATION_MESSAGE);

    but that doesnt work, it gives me this error:
    The method showMessageDialog(Component, Object, String, int, Icon) in the type JOptionPane is not applicable for the arguments (null, Object, Object, String, int)


    so yeah, if anyone would be able to tell me how to add more components from that array in a JOptionpane, that would be amazing!

    thanks in advance


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,149
    Thanks
    48
    Thanked 2,158 Times in 2,131 Posts

    Default Re: This shouldn't be too hard.

    the API it says that you should be able to do
    Which of the methods in the API doc matches what you coded?
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    May 2013
    Posts
    13
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: This shouldn't be too hard.

    never mind bro, i already got it

Similar Threads

  1. Trying hard(im just a beginne)
    By riddick_charel in forum What's Wrong With My Code?
    Replies: 2
    Last Post: February 27th, 2013, 08:20 AM
  2. very hard algorithm implementation
    By TheByt3 in forum What's Wrong With My Code?
    Replies: 3
    Last Post: July 26th, 2012, 11:10 AM
  3. Shouldn't "list" be a parameter of the method Create()?
    By wholegrain in forum Object Oriented Programming
    Replies: 6
    Last Post: February 12th, 2012, 11:40 PM
  4. [SOLVED] Confused about string that I think shouldn't be null
    By mjpam in forum What's Wrong With My Code?
    Replies: 1
    Last Post: April 29th, 2011, 11:08 PM