01: /*
02: * (C) Copyright IBM Corp. 1998-2004. All Rights Reserved.
03: *
04: * The program is provided "as is" without any warranty express or
05: * implied, including the warranty of non-infringement and the implied
06: * warranties of merchantibility and fitness for a particular purpose.
07: * IBM will not be liable for any damages suffered by you as a result
08: * of using the Program. In no event will IBM be liable for any
09: * special, indirect or consequential damages or lost profits even if
10: * IBM has been advised of the possibility of their occurrence. IBM
11: * will not be liable for any third party claims against you.
12: */
13: package com.ibm.richtext.demo;
14:
15: public final class MenuData {
16:
17: static final String COPYRIGHT = "(C) Copyright IBM Corp. 1998-1999 - All Rights Reserved";
18: private String fName;
19: private boolean fHasShortcut;
20: private char fShortcut;
21: private int fShortcutKeyCode;
22:
23: public MenuData(String name) {
24:
25: fName = name;
26: fHasShortcut = false;
27: }
28:
29: public MenuData(String name, char ch, int keyCode) {
30:
31: fName = name;
32: fHasShortcut = true;
33: fShortcut = ch;
34: fShortcutKeyCode = keyCode;
35: }
36:
37: public String getName() {
38:
39: return fName;
40: }
41:
42: public char getShortcut() {
43:
44: if (!fHasShortcut) {
45: throw new Error("Menu doesn't have shortcut");
46: }
47: return fShortcut;
48: }
49:
50: public int getShortcutKeyCode() {
51:
52: return fShortcutKeyCode;
53: }
54:
55: public boolean hasShortcut() {
56:
57: return fHasShortcut;
58: }
59: }
|