Sign in to follow this  

Dialog boxes

This topic is 1114 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

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

This topic is 1114 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this