| Author |
create a console menu using a class.
|
Pete Tyo
Ranch Hand
Joined: May 11, 2005
Posts: 38
|
|
I am trying to find out if there is a class that is already made I can use to create a console menu and receive input. I have been looking around and only thing I can find is class Gmenu which is for gui as far as I can tell. Does this class exist or should I attempt to create it myself? Thanks, Pete
|
 |
Stan James
(instanceof Sidekick)
Ranch Hand
Joined: Jan 29, 2003
Posts: 8791
|
|
If you're going to do a number of interactive console apps, say for school, it would be a neat exercise to make your own. With no thought for how it works, what would you like it to do? Maybe: Given an array of strings for a menu, display the menu, accept user input, return the index of the menu item chosen. If the user enters invalid data, say a number out of range or the word "bob", issue an error message and redisplay the menu. Given a descriptive prompt, display the prompt and accept input from the user. Given a descriptive prompt, a max and a min display the prompt and accept a number in the specified range from the user. Back in my mainframe days I had many interactive console apps and a whole library of prompting routines with fairly sophisticated validation. All the prompts need a way to bail out - like "quit" or something.
|
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
|
 |
Pete Tyo
Ranch Hand
Joined: May 11, 2005
Posts: 38
|
|
I would like it to do pretty much what you said. This is my first Java class so I am a little slow at getting the code out. I have the general concept of what I want down, now just figuring out how to code it... Pete
|
 |
Stan James
(instanceof Sidekick)
Ranch Hand
Joined: Jan 29, 2003
Posts: 8791
|
|
Cool. Try a tiny bit, post it if you get stuck. Keep it fun! Set very small goals, write a few lines of code, make it work, eat one M&M. It's a lot more rewarding (and productive and bug free) to have little successes every few minutes than to slave over a hundred lines of code all night and find it doesn't work.
|
 |
 |
|
|
subject: create a console menu using a class.
|
|
|