Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 

README.md

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

Packages

No packages published

Languages

You can’t perform that action at this time.