Results 1 to 17 of 17

Thread: Daok call Turtle

  1. #1
    DaoK
    Guest

    Daok call Turtle

    Hey hello,

    This post is just to ask a simple question ( any one can answer ).

    We had to make a project in Java at school and we used multiple choice... I have made a menu with an InputBox ( Exemple :

    F=Choice1
    G=Choice2 ... )

    Person had to press the letter then press enter to continue. But some "nerds" licked better marck to the teacher ( ) becauce theu have made in a input box 4-5 buttons. I dont know how they did but it's like a messagebox/inputbox but it a box who you can add some button.

    I know than it's a easy code because I take a little look ( ) but I dont remember it. Can you please help me to prove than I can make something cool like them.

    Daok

  2. #2
    I don't know Swing yet.

  3. #3
    Frenzied Member Motoxpro's Avatar
    Join Date
    Sep 2001
    Location
    Spiro, OK
    Posts
    1,211
    Last edited by Motoxpro; Oct 9th, 2001 at 08:18 PM.

  4. #4
    DaoK
    Guest
    Thank guys for the help !

  5. #5
    Frenzied Member Motoxpro's Avatar
    Join Date
    Sep 2001
    Location
    Spiro, OK
    Posts
    1,211
    Last edited by Motoxpro; Oct 9th, 2001 at 08:20 PM.

  6. #6
    DaoK
    Guest
    Motoxpro you have posted 10 messages who are not related to any topic since the last 5 minutes...please calm down.

  7. #7
    Frenzied Member Motoxpro's Avatar
    Join Date
    Sep 2001
    Location
    Spiro, OK
    Posts
    1,211
    i know i am deleting all of them

  8. #8
    Addicted Member Mrs Kensington's Avatar
    Join Date
    Sep 2001
    Location
    Dorset, UK
    Posts
    144
    I think what your talking about is the JOptionPane, its like the MsgBox in VB but has a lot more complexity.
    Best to look in the Javadoc there's some good examples in there!

    Hope I helped!

  9. #9
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    yeah he is talking about a JOptionPane. I know the class well
    but you have to get yourself a swing book becuase there are tons of constructors for the class as well as constants and static
    dialog display methods. Really too many to list.

  10. #10
    DaoK
    Guest
    I have a book but I am not at that stage can you just give me a sample of a code of JOptionPane with Jbutton on it ( 3-4 buttons who I will be able to add some action on them ). Please I know it's easy but I am not at that chapter in my book and I didnt see it in the Index.

  11. #11
    DaoK
    Guest
    Well, you know a lots of language : VB , C++, java, qbasic.... and you know so many thing about PC... I cannot imagine how you do to know all that.

  12. #12
    I'm learning Java GUI programming at my mentorship at school now.

  13. #13
    DaoK
    Guest
    crap I will need to call you "The Machine" in few

  14. #14
    Addicted Member Mrs Kensington's Avatar
    Join Date
    Sep 2001
    Location
    Dorset, UK
    Posts
    144
    the code you need is...

    Code:
    String options[] = new String[5];
    		
    options[0] = "Button 1";
    options[1] = "Button 2";
    options[2] = "Button 3";
    options[3] = "Button 4";
    options [4] = "Button 5";
    		
    int reply = JOptionPane.showOptionDialog(null, "Click button", "Clicky!",  JOptionPane.DEFAULT_OPTION, 
                                             JOptionPane.WARNING_MESSAGE, null, options, options[0]);
    		
    System.out.println("Reply was " + reply);
    and then just select the reply to see what they clicked!

    the style of the dialog is set by setting the 5th argument to one of the following
    JOptionPane.ERROR_MESSAGE
    JOptionPane.INFORMATION_MESSAGE
    JOptionPane.WARNING_MESSAGE
    JOptionPane.QUESTION_MESSAGE
    JOptionPane.PLAIN_MESSAGE

    Hope that helps!

    oh and congratulations Daok on your 1500th post!

  15. #15
    Addicted Member Mrs Kensington's Avatar
    Join Date
    Sep 2001
    Location
    Dorset, UK
    Posts
    144
    change all that array creation malarkey to
    Code:
    String[] options = { "Button 1", "Button 2", "Button 3", "Button 4", "Button 5" };
    neater that way!

  16. #16
    DaoK
    Guest
    THANK YOU!!!



  17. #17
    DaoK
    Guest
    and congratulations Daok on your 1500th post!
    Thank you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width