Exemplo n.º 1
0
 // removeAll on hide!!!
 public void show(Component invoker, int x, int y) {
   ControlPanel panel = (ControlPanel) invoker.getParent();
   control = (LawControl) panel.getControl();
   removeAll();
   String[] names = control.getPresetNames();
   if (names == null) return;
   for (int i = 0; i < names.length; i++) {
     JMenuItem item = new JMenuItem(names[i]);
     add(item);
     item.addActionListener(this);
   }
   // create dynamic menu here
   super.show(invoker, x, y);
 }
Exemplo n.º 2
0
 public void actionPerformed(ActionEvent event) {
   control.applyPreset(event.getActionCommand());
 }