Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 dialog box
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
ilovechicken




PostPosted: Thu Jun 02, 2005 7:47 pm   Post subject: dialog box

i was just wondering if anyone can help me out creating a dialog box that allows the user to enter a string (ie. their name) and then closes when they are done
Sponsor
Sponsor
Sponsor
sponsor
Hikaru79




PostPosted: Thu Jun 02, 2005 7:58 pm   Post subject: (No subject)

Java:
String s = (String)JOptionPane.showInputDialog(null,"What is your name?",
                    "Answer me these questions three!",
                    JOptionPane.PLAIN_MESSAGE,
                    null,
                    null,
                    "ilovechicken");
       System.out.println(s);

There you go Smile Of course, swing must be imported for JOptionPane to be found.
ilovechicken




PostPosted: Thu Jun 02, 2005 8:24 pm   Post subject: heh?

swing must be imported? is that like a
import swing.*;
or something?
wtd




PostPosted: Thu Jun 02, 2005 9:03 pm   Post subject: Re: heh?

ilovechicken wrote:
swing must be imported? is that like a
import swing.*;
or something?


javax.swing.*, actually.

Check out the API reference at java.sun.com.
ilovechicken




PostPosted: Thu Jun 02, 2005 10:25 pm   Post subject: wow

wow, that is unbelievably efficient and easy. thanks a lot.
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: