I have a class that extends JSvgCanvas.
Now I want to have my own key-event-handlers and disable the default ones. For example, I want to be able to "select" multiple objects when holding down the Ctrl-key, but right now, holding down the Ctrl-key will make it drag a zoom-box instead.
 
I tried the following code (which will probably make more experienced Java-devellopers will probably laugh your asses of), but to no avail:
  // Tell the Canvas not to use the Tab-key to move to the next control
  this.setFocusTraversalKeysEnabled(false);
  
// Remove all the current KeyListeners
  KeyListener[] kl = this.getKeyListeners();
  for (int x = 0; x < kl.length; x++)
   this.removeKeyListener(kl[x]);
  
  // Implement a Key-listener for Tab, Ctrl, Shift and Delete-Key-Presses
  this.addKeyListener(new JSvgCanvasEnhKeyHandler());
 
 
 
Regards
Henric Rosvall

Reply via email to