jTracer  1.03
Stack trace visualization tool
JMenuItem org.libcsdbg.jtracer.MenuBar.createItem ( String  text,
int  mnemonic,
int  accel 
)
private

Create a menu item.

Parameters
[in]textthe item caption
[in]mnemonicthe item shortcut key
[in]accelthe item accelerator key
Returns
the created item

Definition at line 227 of file MenuBar.java.

References org.libcsdbg.jtracer.Registry.get(), and org.libcsdbg.jtracer.MenuBar.handler.

228  {
229  JMenuItem retval = new JMenuItem(text + " ");
230  retval.setMnemonic(mnemonic);
231 
232  Registry conf = Registry.getCurrent();
233  retval.setFont((Font) conf.get("component", "font"));
234  retval.setForeground((Color) conf.get("component", "fgcolor"));
235 
236  Integer delay = (Integer) conf.get("component", "click-delay");
237  if (delay != null)
238  retval.setMultiClickThreshhold(delay);
239 
240  if (accel != 0) {
241  int modifiers = 0;
242  if (accel < VK_F1 || accel > VK_F12)
243  modifiers |= InputEvent.CTRL_DOWN_MASK;
244 
245  KeyStroke ks = KeyStroke.getKeyStroke(accel, modifiers);
246  retval.setAccelerator(ks);
247  }
248 
249  /* The action command is the item caption with the trailing dots trimmed */
250  text = text.replace('.', ' ').trim();
251  retval.setActionCommand(text);
252  retval.addActionListener(handler);
253 
254  String nm = text.toLowerCase().replace(' ', '_') + "16.png";
255  retval.setIcon(conf.loadIcon(nm));
256  return retval;
257  }
ActionListener handler
Event handler.
Definition: MenuBar.java:46

+ Here is the call graph for this function: