-
Basic interface menu
Creating a simple interface menu.
My problem goes as follows, I have created the class and the menu but I am struggling with understanding how to create interaction i.e when "press A" on the keyboard the single accessor method of the class should be called. When "X" is pressed the terminal should close.
I hope someone could point me in the right direction.
This is the unfinished code:
Code:
public void displayMenu()
{
System.out.println("A. Display Book");
System.out.println();
System.out.println("X. Exit");
}
public String displayBook()
{
return "This is the only attribute of the class";
}
-
Read from the cli is very easy using the Console class.
Console (Java Platform SE 6)
-
Thanks xerberuz,
Appriciate it. I'm reading the link now
I would still appriciate some more clues.
Anyway, I promiss to post the working code when I have found out of it