JAVA question - checkpoints

Alex

Diamond Member
Oct 26, 1999
6,995
0
0
ok so im doing a program that has a main menu with many options.

so the user pics option 1, i run the code, display the info and return to the menu

this goes on for every option until the user selects quit...

so i'm wondering how to set a checkpoint or something for menu so i can just send the program back to it after running the command for each option (similar to 'goto' command in VB...)

any help greatly appreciated! :)
 

m0ti

Senior member
Jul 6, 2001
975
0
0
not quite sure what you mean.

does the menu window change in any way as a result of running the command?

In general you should have a method to set-up/tear-down visual components as needed (or you can also overlay one on top of the other). Then you can just call that method to return to whatever original state you want.
 

manly

Lifer
Jan 25, 2000
13,589
4,239
136
I had to read this a few times, but if he's talking about JMenus, it sounds like he wants a menu item to perform some work and then return focus to the open menu right at the menu item following the one that was just invoked.

I'm not aware that JMenus do that, and I'd probably build a custom GUI in a JPanel to represent the sequential tasks visually rather than rely on menus. That doesn't seem to be the most intuitive usage.
 

cjohnson

Junior Member
Oct 10, 2002
21
0
0
It sounds to me like you're talking about a console-based menu system. And when I do something like this, what I generally do is have a loop that loops until the user selects quit, for the submenu's i just use continue and/or break statements to get out of the submenu and back to the main menu. Hope this helps (I'll post some sample code if you still don't get what I mean).