Jump to content
  • Advertisement
Sign in to follow this  
Richar003

Dialog boxes

This topic is 1333 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

All I want to do is get user input of integers in Java but I can't seem to find anything in my manual or looking through Javadoc of what I can find. I've implemented a menu to be able to auto-henerate a maze but need to enter the dimensions, etc.

 

Please help - my thank in advance.

Share this post


Link to post
Share on other sites
Advertisement

Yes but isn't the AWT and Swing both standard parts of Java?

Thank you I just wanted to get the class since I couldn't find them in the manual and was uninspired in the names I tries.

Share this post


Link to post
Share on other sites

If you're using swing then the simple solution is to use the JOptionPane with the showInputDialog() method.

 

The tutorial is here: https://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html#input

Javadocs are here:  https://docs.oracle.com/javase/7/docs/api/javax/swing/JOptionPane.html

 

If you want to get fancy and make the dialog yourself they have an example of that too.  https://docs.oracle.com/javase/tutorial/displayCode.html?code=https://docs.oracle.com/javase/tutorial/uiswing/examples/components/DialogDemoProject/src/components/CustomDialog.java

 

You may benefit from looking at all the examples that come with the SDK.  There's an examples folder in there will tons of examples of pretty much anything a beginner will need.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!