|
-
Oct 9th, 2001, 06:17 PM
#1
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
-
Oct 9th, 2001, 07:19 PM
#2
Member
I don't know Swing yet.
-
Oct 9th, 2001, 07:55 PM
#3
Frenzied Member
Last edited by Motoxpro; Oct 9th, 2001 at 08:18 PM.
-
Oct 9th, 2001, 08:02 PM
#4
-
Oct 9th, 2001, 08:09 PM
#5
Frenzied Member
Last edited by Motoxpro; Oct 9th, 2001 at 08:20 PM.
-
Oct 9th, 2001, 08:19 PM
#6
Motoxpro you have posted 10 messages who are not related to any topic since the last 5 minutes...please calm down.
-
Oct 9th, 2001, 08:21 PM
#7
Frenzied Member
i know i am deleting all of them
-
Oct 10th, 2001, 04:04 AM
#8
Addicted Member
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!
-
Oct 10th, 2001, 09:41 AM
#9
Dazed Member
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.
-
Oct 11th, 2001, 06:51 PM
#10
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.
-
Oct 11th, 2001, 08:13 PM
#11
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.
-
Oct 11th, 2001, 08:14 PM
#12
Member
I'm learning Java GUI programming at my mentorship at school now.
-
Oct 11th, 2001, 08:15 PM
#13
crap I will need to call you "The Machine" in few
-
Oct 12th, 2001, 08:56 AM
#14
Addicted Member
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!
-
Oct 12th, 2001, 09:24 AM
#15
Addicted Member
change all that array creation malarkey to
Code:
String[] options = { "Button 1", "Button 2", "Button 3", "Button 4", "Button 5" };
neater that way!
-
Oct 12th, 2001, 04:35 PM
#16
THANK YOU!!!
-
Oct 12th, 2001, 04:43 PM
#17
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|