1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.devaki.nextobjects.ui.components;
21 import javax.swing.ImageIcon;
22 import javax.swing.JMenuItem;
23 import javax.swing.KeyStroke;
24 import org.devaki.nextobjects.constants.CstImages;
25 /***
26 * This class overwrite the 'JMenuItem' component
27 */
28 public class CustomMenuItem extends JMenuItem
29 {
30 /***
31 * Construct a 'CustomMenuItem' object
32 * @param label Name
33 * @param mnemonic Shortcut letter
34 * @param isEnabled Is the component enabled
35 */
36 public CustomMenuItem(
37 final String label,
38 final int mnemonic,
39 final boolean isEnabled)
40 {
41 super(label, mnemonic);
42
43 this.setIcon(CstImages.ICN_BLANK);
44
45 this.setEnabled(isEnabled);
46 }
47 /***
48 * Construct a 'CustomMenuItem' object
49 * @param label Name
50 * @param icon Icon
51 * @param mnemonic Shortcut letter
52 * @param isEnabled Is the component enabled
53 */
54 public CustomMenuItem(
55 final String label,
56 final ImageIcon icon,
57 final int mnemonic,
58 final boolean isEnabled)
59 {
60 super(label, mnemonic);
61
62 this.setIcon(icon);
63
64 this.setEnabled(isEnabled);
65 }
66 /***
67 * Construct a 'CustomMenuItem' object
68 * @param label Name
69 * @param mnemonic Shortcut letter
70 * @param accelerator Shortcut keys
71 * @param isEnabled Is the component enabled
72 */
73 public CustomMenuItem(
74 final String label,
75 final int mnemonic,
76 final KeyStroke accelerator,
77 final boolean isEnabled)
78 {
79 super(label, mnemonic);
80
81 this.setIcon(CstImages.ICN_BLANK);
82
83 this.setAccelerator(accelerator);
84
85 this.setEnabled(isEnabled);
86 }
87 /***
88 * Construct a 'CustomMenuItem' object
89 * @param label Name
90 * @param icon Icon
91 * @param mnemonic Shortcut letter
92 * @param accelerator Shortcut keys
93 * @param isEnabled Is the component enabled
94 */
95 public CustomMenuItem(
96 final String label,
97 final ImageIcon icon,
98 final int mnemonic,
99 final KeyStroke accelerator,
100 final boolean isEnabled)
101 {
102 super(label, mnemonic);
103
104 this.setIcon(icon);
105
106 this.setAccelerator(accelerator);
107
108 this.setEnabled(isEnabled);
109 }
110 }