Skip to content
This repository has been archived by the owner on May 19, 2022. It is now read-only.
/ JMenu Public archive

A menu library created to aid with the creation of console menus.

License

Notifications You must be signed in to change notification settings

NickAcPT/JMenu

Repository files navigation

JMenu

A menu library created to aid with the creator of console menus.

Usage

import io.github.nickacpt.jmenu.JMenu;
import io.github.nickacpt.jmenu.annotations.ExitOption;
import io.github.nickacpt.jmenu.annotations.Option;

public class NiceMenu extends JMenu {

    @Option(ordinal = 0, key = '1', description = "Option One")
    public void optionOne() {
        // Implementation here
    }

    @Option(ordinal = 1, key = '2', description = "Option Two")
    public void optionTwo() {
        // Implementation here
    }
    
    @Option(ordinal = 100, key = '0', description = "Exit")
    @ExitOption
    public void exit() {}
}

Then, to invoke the menu, just create a new instance of the class.

new NiceMenu().run();

or, if you want the menu to repeat until the user exits it, use

new NiceMenu().runLooping();

Result:

===============================================================
1 - Option One
2 - Option Two
0 - Exit
Select the option:
===============================================================

About

A menu library created to aid with the creation of console menus.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages