01: /*
02: * ActionItem.java Copyright (c) 2006,07 Swaroop Belur
03: *
04: * This program is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU General Public License
06: * as published by the Free Software Foundation; either version 2
07: * of the License, or (at your option) any later version.
08:
09: * This program 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
12: * GNU General Public License for more details.
13:
14: * You should have received a copy of the GNU General Public License
15: * along with this program; if not, write to the Free Software
16: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17: *
18: */
19:
20: package net.sf.jdec.ui.core;
21:
22: import net.sf.jdec.ui.event.ActionItemListener;
23:
24: import javax.swing.JMenuItem;
25:
26: /**
27: *@author swaroop belur
28: */
29: public class ActionItem extends UIObject {
30:
31: public void setDesc(java.lang.String desc) {
32: this .whatAmI = desc;
33: }
34:
35: private JMenuItem menuItem = null;
36: private ToolbarItem toolBaritem = null;
37:
38: public ActionItem(java.lang.String item) {
39: menuItem = new JMenuItem(item);
40: addListener(menuItem);
41: }
42:
43: public JMenuItem getItem() {
44: return menuItem;
45: }
46:
47: public ToolbarItem getParent() {
48: return toolBaritem;
49: }
50:
51: public void setParent(ToolbarItem toolBaritem) {
52: this .toolBaritem = toolBaritem;
53: }
54:
55: private void addListener(JMenuItem menuItem) {
56:
57: menuItem.addActionListener(ActionItemListener.getListener());
58: }
59:
60: }
|