1 // Copyright 2007 Google Inc. All Rights Reserved. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); You may not 4 // use this file except in compliance with the License. You may obtain a copy of 5 // the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by 6 // applicable law or agreed to in writing, software distributed under the 7 // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 8 // OF ANY KIND, either express or implied. See the License for the specific 9 // language governing permissions and limitations under the License. 10 11 package com.google.scrollview.ui; 12 13 /** 14 * A MenuListItem is any sort of menu entry. This can either be within a popup 15 * menu or within a menubar. It can either be a submenu (only name and 16 * command-id) or a name with an associated value and possibly description. They 17 * can also have new entries added (if they are submenus). 18 * 19 * @author wanke@google.com 20 */ 21 22 import javax.swing.JMenu; 23 24 /** Constructs a new submenu which can hold other entries. */ 25 class SVSubMenuItem extends SVAbstractMenuItem { SVSubMenuItem(String name, JMenu jli)26 public SVSubMenuItem(String name, JMenu jli) { 27 super(-1, name, jli); 28 } 29 /** Adds a child entry to the submenu. */ 30 @Override add(SVAbstractMenuItem mli)31 public void add(SVAbstractMenuItem mli) { 32 mi.add(mli.mi); 33 } 34 /** Adds a child menu to the submenu (or root node). */ 35 @Override add(JMenu jli)36 public void add(JMenu jli) { 37 mi.add(jli); 38 } 39 } 40 41 42