View Javadoc
1 /* 2 * JScroll - the scrollable desktop pane for Java. 3 * Copyright (C) 2003 Tom Tessier 4 * 5 * This program is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU General Public License 7 * as published by the Free Software Foundation; either version 2 8 * of the License, or (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 * 19 */ 20 21 package org.jscroll.widgets; 22 23 import javax.swing.*; 24 25 import java.awt.event.*; 26 27 28 /*** 29 * This class creates a generic base menu item. ActionListener, mnemonic, 30 * keyboard shortcut, and title are set via the constructor. 31 * 32 * @author <a href="mailto:tessier@gabinternet.com">Tom Tessier</a> 33 * @version 1.0 29-Jan-2001 34 */ 35 public class RootMenuItem extends JMenuItem { 36 /*** 37 * creates the RootMenuItem 38 * 39 * @param listener the action listener to assign 40 * @param itemTitle the title of the item 41 * @param mnemonic the mnemonic used to access the menu 42 * @param shortcut the keyboard shortcut used to access the menu. 43 * -1 indicates no shortcut. 44 */ 45 public RootMenuItem(ActionListener listener, String itemTitle, 46 int mnemonic, int shortcut) { 47 super(itemTitle, mnemonic); 48 49 // set the alt-Shortcut accelerator 50 if (shortcut != -1) { 51 setAccelerator(KeyStroke.getKeyStroke(shortcut, ActionEvent.ALT_MASK)); 52 } 53 54 setActionCommand(itemTitle); 55 addActionListener(listener); 56 } 57 }

This page was automatically generated by Maven