View Javadoc

1   package org.devaki.nextobjects.ui.components;
2   /*
3   
4   nextobjects Copyright (C) 2001-2005 Emmanuel Florent
5   
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by the
8   Free Software Foundation; either version 2 of the License, or (at your
9   option) any later version.
10  
11  This program is distributed in the hope that it will
12  be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
13  of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14  PURPOSE. See the GNU General Public License for more details.
15  
16  You should have received a copy of the GNU General Public License along
17  with this program; if not, write to the Free Software Foundation, Inc., 59
18  Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19  
20  */
21  import javax.swing.ImageIcon;
22  import javax.swing.JMenu;
23  /***
24   * This class overwrite of the 'JMenu' swing component
25   * @author     <a href="mailto:eflorent@devaki.org">Emmanuel Florent</a>
26   */
27  public class CustomMenu extends JMenu
28  {
29      /***
30       * Construct a 'CustomMenu' object
31       * @param label Name
32       * @param mnemonic Shortcut letter
33       */
34      public CustomMenu(final String label, final int mnemonic)
35      {
36          super(label);
37          // Set the mnemonic letter
38          this.setMnemonic(mnemonic);
39      }
40      /***
41       * Construct a 'CustomMenu' object
42       * @param label Name
43       * @param mnemonic Shortcut letter
44       * @param icon Icon
45       */
46      public CustomMenu(
47          final String label,
48          final int mnemonic,
49          final ImageIcon icon)
50      {
51          // Custom
52          super(label);
53          // Set the mnemonic letter
54          this.setMnemonic(mnemonic);
55          // Set the icon
56          this.setIcon(icon);
57      }
58  }