Results 1 to 3 of 3
  1. #1
    Matthew is offline Member
    Join Date
    Apr 2010
    Location
    Melbourne
    Posts
    4
    Rep Power
    0

    Default 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:

    Java 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";   
    }

  2. #2
    xerberuz is offline Member
    Join Date
    Apr 2010
    Posts
    8
    Rep Power
    0

    Default

    Read from the cli is very easy using the Console class.
    Console (Java Platform SE 6)

  3. #3
    Matthew is offline Member
    Join Date
    Apr 2010
    Location
    Melbourne
    Posts
    4
    Rep Power
    0

    Default

    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

Similar Threads

  1. Fill a menu dynamically when menu is shown
    By Java Tip in forum SWT Tips
    Replies: 0
    Last Post: 07-07-2008, 05:47 PM
  2. How to use SWT menu and menu event
    By Java Tip in forum SWT Tips
    Replies: 0
    Last Post: 07-07-2008, 05:46 PM
  3. React to menu action and checkbox menu
    By Java Tip in forum javax.swing
    Replies: 0
    Last Post: 06-27-2008, 08:50 PM
  4. Replies: 7
    Last Post: 05-09-2008, 08:54 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •