public class TestMenu
1: //TestMenu.java
2: public class TestMenu
3: {
4: public static void main(String[] args)
5: {
6: Menu menu = new Menu("My Menu");
7: menu.addOption("Quit");
8: menu.addOption("Get some information about this program");
9: menu.addOption("Do this");
10: menu.addOption("Do that");
11: int menuChoice;
12: do
13: {
14: menu.display();
15: menuChoice = menu.getChoice();
16: switch (menuChoice)
17: {
18: case 1:
19: case -1:
20: Utils.pause(0, "\nProgram now terminating.");
21: break;
22: case 2:
23: Utils.pause(0, "\nGetting program information.");
24: break;
25: case 3:
26: Utils.pause(0, "\nDoing this.");
27: break;
28: case 4:
29: Utils.pause(0, "\nDoing that.");
30: break;
31: }
32: }
33: while (menuChoice != 1 && menuChoice != -1);
34: }
35: }