ch.claudio.pen
Class Menu

java.lang.Object
  extended by ch.claudio.pen.Menu

public class Menu
extends java.lang.Object

One way to present multi level menu in just one rectangle. Let's say the main menu is A. B. C, and A has a submenu Aa, Ab, Ac and Ac has a submenu Ac1, Ac2, Ac3, Ac4. The first menu presents the items A, B, C all with a bright background (e.g. white). If the user selects A the menu is replaced with a new one containing A, Aa, Ab, Ac where A has a darker background (e.g. light grey) while Aa, Ab and Ac have the bright background. The user can click on A and will get back to the main menu, or click on Ac to get one submen down. In that case the menu will contain A, Ac, Ac1, Ac2, Ac3 and Ac4 where A and Ac have a darker and Ac1, Ac2, Ac3 and Ac4 a bright background. This scheme assumes, that a node is either an action node or contains a submenu.

Version:
$Id: Menu.java 148 2006-09-14 20:52:32Z claudio $
Author:
Claudio Nieder

Copyright (C) 2006 Claudio Nieder <private@claudio.ch>, CH-8610 Uster

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA


Constructor Summary
Menu(MenuItem[] itemsArg)
          Create
 
Method Summary
 void displayAt(java.awt.Graphics g, int x, int y)
           
 void higlight(java.awt.Component c, int x, int y)
          Call repaint if the cursor position needs higlighting another menu item.
static void main(java.lang.String[] args)
          Print license.
 void select(int x, int y)
          Execute the action below the cursor position
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Menu

public Menu(MenuItem[] itemsArg)
Create

Parameters:
itemsArg -
Method Detail

displayAt

public void displayAt(java.awt.Graphics g,
                      int x,
                      int y)
Parameters:
g -
x -
y -

higlight

public void higlight(java.awt.Component c,
                     int x,
                     int y)
Call repaint if the cursor position needs higlighting another menu item.

Parameters:
c -
x -
y -

select

public void select(int x,
                   int y)
Execute the action below the cursor position

Parameters:
x - currently ignored
y - position of cursor

main

public static void main(java.lang.String[] args)
Print license.

Parameters:
args - ignored