Here you can find the source of loadMenuItem(String action)
Parameter | Description |
---|---|
action | Plugin action name |
JMenuItem
public static JMenuItem loadMenuItem(String action)
//package com.java2s; /*//from www . j a va2 s.c om * 03/31/2002 - 16:00:13 * * GUIUtilities.java - Very useful methods to build a GUI * Portions copyright (C) 1998-2000 Slava Pestov * * 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; either version 2 * of the License, or any later version. * * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ import javax.swing.*; public class Main { /** * This method creates a new JMenuItem. This special version is * targeted to be used with plugins. * @param action Plugin action name * @return A new <code>JMenuItem</code> */ public static JMenuItem loadMenuItem(String action) { /* String name = /*Jext.getProperty(action.concat(".label"))action; if (name == null) name = (new java.util.Date()).toString(); return loadMenuItem(name, action, null, true, true); */ return null; } /** * This method creates a new JMenuItem. See menus/XMenuHandler.class * for more informations about its usage. * @param label The menu item label * @param action The name of the action, specified in Jext * @param keyStroke The keystroke used as accelerator * @param picture Relative path to an icon * @param enabled Disable the item if false * @return A new <code>JMenuItem</code> */ public static JMenuItem loadMenuItem(String label, String action, String picture, boolean enabled) { return loadMenuItem(label, action, picture, enabled, true); } /** * This method creates a new JMenuItem. See menus/XMenuHandler.class * for more informations about its usage. * @param label The menu item label * @param action The name of the action, specified in Jext * @param keyStroke The keystroke used as accelerator * @param picture Relative path to an icon * @param enabled Disable the item if false * @param list If true adds item info to a list * @return A new <code>JMenuItem</code> */ public static JMenuItem loadMenuItem(String label, String action, String picture, boolean enabled, boolean list) { /* String keyStroke = new String(); if (label == null) return null; EnhancedMenuItem mi; int index = label.indexOf('$'); if (action != null) { String _keyStroke = /*Jext.getProperty(action.concat(".shortcut"))"shoortcut"; if (_keyStroke != null) keyStroke = _keyStroke; } if (index != -1 && label.length() - index > 1) { mi = new EnhancedMenuItem(label.substring(0, index).concat(label.substring(++index)), keyStroke); mi.setMnemonic(Character.toLowerCase(label.charAt(index))); } else mi = new EnhancedMenuItem(label, keyStroke); if (picture != null) { ImageIcon icon = Utilities.getIcon(/*picture.concat(Jext.getProperty("jext.look.icons")).concat(".gif")"picture, "Jext.class"); if (icon != null) mi.setIcon(icon); } // if (keyStroke != null) mi.setAccelerator(parseKeyStroke(keyStroke)); if (action != null) { MenuAction a = Jext.getAction(action); if (a == null) mi.setEnabled(false); else { mi.addActionListener(a); mi.setEnabled(enabled); if (list) { StringBuffer _buf = new StringBuffer(label.length()); char c; for (int i = 0; i < label.length(); i++) { if ((c = label.charAt(i)) != '$') _buf.append(c); } if (action.startsWith("one_")) _buf.append(" (One Click!)"); if (menuItemsActions.get(action) == null) menuItemsActions.put(action, _buf.toString()); } } } else mi.setEnabled(enabled); return mi; */ return null; } }