01: /*
02: * Copyright (C) 2005 Jeff Tassin
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2.1 of the License, or (at your option) any later version.
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: */
18:
19: package com.jeta.swingbuilder.gui.main;
20:
21: import javax.swing.JMenuItem;
22: import javax.swing.JPopupMenu;
23: import javax.swing.KeyStroke;
24:
25: import com.jeta.open.i18n.I18N;
26: import com.jeta.swingbuilder.gui.components.TSComponentNames;
27:
28: public class FormEditorPopupMenu extends JPopupMenu {
29: /**
30: * Creates a menu item for this popup
31: *
32: * @param itemText
33: * the text to show for the menu item
34: * @param actionCmd
35: * the name of the action that is fired when the menu item is
36: * selected
37: * @param keyStroke
38: * the keyboard accelerator
39: */
40: public static JMenuItem createMenuItem(String itemText,
41: String actionCmd, KeyStroke keyStroke) {
42: JMenuItem item = new JMenuItem(itemText);
43: item.setActionCommand(actionCmd);
44: item.setName(actionCmd);
45: if (keyStroke != null)
46: item.setAccelerator(keyStroke);
47: return item;
48: }
49:
50: /**
51: * ctor
52: */
53: public FormEditorPopupMenu() {
54: add(createMenuItem(I18N.getLocalizedMessage("Cut"),
55: TSComponentNames.ID_CUT, null));
56: add(createMenuItem(I18N.getLocalizedMessage("Copy"),
57: TSComponentNames.ID_COPY, null));
58: add(createMenuItem(I18N.getLocalizedMessage("Paste"),
59: TSComponentNames.ID_PASTE, null));
60: add(createMenuItem(I18N.getLocalizedMessage("Paste Special"),
61: FormEditorNames.ID_PASTE_SPECIAL, null));
62:
63: addSeparator();
64: add(createMenuItem(I18N.getLocalizedMessage("Insert Column"),
65: FormEditorNames.ID_INSERT_COLUMN_LEFT, null));
66: add(createMenuItem(I18N.getLocalizedMessage("Delete Column"),
67: FormEditorNames.ID_DELETE_COLUMN, null));
68:
69: addSeparator();
70:
71: add(createMenuItem(I18N.getLocalizedMessage("Insert Row"),
72: FormEditorNames.ID_INSERT_ROW_ABOVE, null));
73: add(createMenuItem(I18N.getLocalizedMessage("Delete Row"),
74: FormEditorNames.ID_DELETE_ROW, null));
75:
76: }
77:
78: }
|