Java Code Examples for java.awt.event.KeyEvent#getComponent()

The following examples show how to use java.awt.event.KeyEvent#getComponent() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PaletteUI.java    From pumpernickel with MIT License 6 votes vote down vote up
@Override
public void keyPressed(KeyEvent e) {
	int dx = 0;
	int dy = 0;
	if (e.getKeyCode() == KeyEvent.VK_LEFT) {
		dx = -1;
	} else if (e.getKeyCode() == KeyEvent.VK_RIGHT) {
		dx = 1;
	} else if (e.getKeyCode() == KeyEvent.VK_UP) {
		dy = -1;
	} else if (e.getKeyCode() == KeyEvent.VK_DOWN) {
		dy = 1;
	}

	if (dx != 0 || dy != 0) {
		e.consume();
		JPalette palette = (JPalette) e.getComponent();
		nudge(palette, dx, dy);
	}
}
 
Example 2
Source File: MWPanePopupListener.java    From wpcleaner with Apache License 2.0 6 votes vote down vote up
/**
 * Show popup menu in response to a key event.
 * 
 * @param e Event.
 */
@Override
protected void showPopup(KeyEvent e) {

  // Retrieve information
  if (!(e.getComponent() instanceof MWPane)) {
    return;
  }
  MWPane textPane = (MWPane) e.getComponent();
  try {
    Rectangle rect = textPane.modelToView(textPane.getCaretPosition());
    showPopup(textPane, textPane.getSelectionStart(), rect.x, rect.y);
  } catch (BadLocationException e1) {
    //
  }
}
 
Example 3
Source File: DefaultKeyboardFocusManager.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * This method will be called by <code>dispatchKeyEvent</code>. It will
 * handle any unconsumed KeyEvents that map to an AWT
 * <code>MenuShortcut</code> by consuming the event and activating the
 * shortcut.
 *
 * @param e the KeyEvent to post-process
 * @return <code>true</code>
 * @see #dispatchKeyEvent
 * @see MenuShortcut
 */
public boolean postProcessKeyEvent(KeyEvent e) {
    if (!e.isConsumed()) {
        Component target = e.getComponent();
        Container p = (Container)
            (target instanceof Container ? target : target.getParent());
        if (p != null) {
            p.postProcessKeyEvent(e);
        }
    }
    return true;
}
 
Example 4
Source File: NumericKeyListener.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void keyTyped(KeyEvent evt) {
    if (!Character.isDigit(evt.getKeyChar()) && !Character.isISOControl(evt.getKeyChar())) {
        evt.consume();
        Component c = evt.getComponent();
        if (c != null) {
            c.getToolkit().beep();
        }
    }
}
 
Example 5
Source File: DefaultKeyboardFocusManager.java    From jdk-1.7-annotated with Apache License 2.0 5 votes vote down vote up
/**
 * This method will be called by <code>dispatchKeyEvent</code>. It will
 * handle any unconsumed KeyEvents that map to an AWT
 * <code>MenuShortcut</code> by consuming the event and activating the
 * shortcut.
 *
 * @param e the KeyEvent to post-process
 * @return <code>true</code>
 * @see #dispatchKeyEvent
 * @see MenuShortcut
 */
public boolean postProcessKeyEvent(KeyEvent e) {
    if (!e.isConsumed()) {
        Component target = e.getComponent();
        Container p = (Container)
            (target instanceof Container ? target : target.getParent());
        if (p != null) {
            p.postProcessKeyEvent(e);
        }
    }
    return true;
}
 
Example 6
Source File: DefaultKeyboardFocusManager.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * This method will be called by <code>dispatchKeyEvent</code>. It will
 * handle any unconsumed KeyEvents that map to an AWT
 * <code>MenuShortcut</code> by consuming the event and activating the
 * shortcut.
 *
 * @param e the KeyEvent to post-process
 * @return <code>true</code>
 * @see #dispatchKeyEvent
 * @see MenuShortcut
 */
public boolean postProcessKeyEvent(KeyEvent e) {
    if (!e.isConsumed()) {
        Component target = e.getComponent();
        Container p = (Container)
            (target instanceof Container ? target : target.getParent());
        if (p != null) {
            p.postProcessKeyEvent(e);
        }
    }
    return true;
}
 
Example 7
Source File: DefaultKeyboardFocusManager.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * This method will be called by <code>dispatchKeyEvent</code>. It will
 * handle any unconsumed KeyEvents that map to an AWT
 * <code>MenuShortcut</code> by consuming the event and activating the
 * shortcut.
 *
 * @param e the KeyEvent to post-process
 * @return <code>true</code>
 * @see #dispatchKeyEvent
 * @see MenuShortcut
 */
public boolean postProcessKeyEvent(KeyEvent e) {
    if (!e.isConsumed()) {
        Component target = e.getComponent();
        Container p = (Container)
            (target instanceof Container ? target : target.getParent());
        if (p != null) {
            p.postProcessKeyEvent(e);
        }
    }
    return true;
}
 
Example 8
Source File: MainPanel.java    From java-swing-tips with MIT License 5 votes vote down vote up
@Override public void keyPressed(KeyEvent e) {
  JTextField textField = (JTextField) e.getComponent();
  String text = textField.getText();
  shouldHide = false;
  switch (e.getKeyCode()) {
    case KeyEvent.VK_RIGHT:
      for (String s: list) {
        if (s.startsWith(text)) {
          textField.setText(s);
          return;
        }
      }
      break;
    case KeyEvent.VK_ENTER:
      if (!list.contains(text)) {
        list.add(text);
        Collections.sort(list);
        // setSuggestionModel(comboBox, new DefaultComboBoxModel(list), text);
        setSuggestionModel(comboBox, getSuggestedModel(list, text), text);
      }
      shouldHide = true;
      break;
    case KeyEvent.VK_ESCAPE:
      shouldHide = true;
      break;
    default:
      break;
  }
}
 
Example 9
Source File: DefaultKeyboardFocusManager.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * This method will be called by <code>dispatchKeyEvent</code>. It will
 * handle any unconsumed KeyEvents that map to an AWT
 * <code>MenuShortcut</code> by consuming the event and activating the
 * shortcut.
 *
 * @param e the KeyEvent to post-process
 * @return <code>true</code>
 * @see #dispatchKeyEvent
 * @see MenuShortcut
 */
public boolean postProcessKeyEvent(KeyEvent e) {
    if (!e.isConsumed()) {
        Component target = e.getComponent();
        Container p = (Container)
            (target instanceof Container ? target : target.getParent());
        if (p != null) {
            p.postProcessKeyEvent(e);
        }
    }
    return true;
}
 
Example 10
Source File: DefaultKeyboardFocusManager.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * This method will be called by <code>dispatchKeyEvent</code>. It will
 * handle any unconsumed KeyEvents that map to an AWT
 * <code>MenuShortcut</code> by consuming the event and activating the
 * shortcut.
 *
 * @param e the KeyEvent to post-process
 * @return <code>true</code>
 * @see #dispatchKeyEvent
 * @see MenuShortcut
 */
public boolean postProcessKeyEvent(KeyEvent e) {
    if (!e.isConsumed()) {
        Component target = e.getComponent();
        Container p = (Container)
            (target instanceof Container ? target : target.getParent());
        if (p != null) {
            p.postProcessKeyEvent(e);
        }
    }
    return true;
}
 
Example 11
Source File: PopupListener.java    From otroslogviewer with Apache License 2.0 5 votes vote down vote up
@Override
public void keyPressed(KeyEvent e) {
  Point p = new Point(e.getComponent().getLocation());

  if (e.getKeyCode() == 525) {
    if (e.getComponent() instanceof JTable) {
      JTable table = (JTable) e.getComponent();
      int selectedRow = table.getSelectedRow();
      Rectangle cellRect = table.getCellRect(selectedRow, 0, true);
      p.setLocation(cellRect.getCenterX(), cellRect.getCenterY());
    }
    showMenu(e.getComponent(), (int) p.getX(), (int) p.getY());
  }
}
 
Example 12
Source File: KeyBindingOverrideKeyEventDispatcher.java    From ghidra with Apache License 2.0 5 votes vote down vote up
private boolean willBeHandledByTextComponent(KeyEvent event) {

		Component destination = event.getComponent();
		if (destination == null) {
			Component focusOwner = focusProvider.getFocusOwner();
			destination = focusOwner;
		}

		if (!(destination instanceof JTextComponent)) {
			return false; // we only handle text components
		}

		// Note: don't do this--it breaks key event handling for text components, as they do 
		//       not get to handle key events when they are not editable (they still should 
		//       though, so things like built-in copy/paste still work).
		// JTextComponent textComponent = (JTextComponent) focusOwner;
		// if (!textComponent.isEditable()) {
		//	return false;
		// }

		// We've made the executive decision to allow all keys to go through to the text component
		// unless they are modified with the 'Alt'/'Ctrl'/etc keys, unless they directly used 
		// by the text component
		if (!isModified(event)) {
			return true; // unmodified keys will be given to the text component
		}

		// the key is modified; let it through if the component has a mapping for the key
		return hasRegisteredKeyBinding((JTextComponent) destination, event);
	}
 
Example 13
Source File: DefaultKeyboardFocusManager.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * This method will be called by <code>dispatchKeyEvent</code>. It will
 * handle any unconsumed KeyEvents that map to an AWT
 * <code>MenuShortcut</code> by consuming the event and activating the
 * shortcut.
 *
 * @param e the KeyEvent to post-process
 * @return <code>true</code>
 * @see #dispatchKeyEvent
 * @see MenuShortcut
 */
public boolean postProcessKeyEvent(KeyEvent e) {
    if (!e.isConsumed()) {
        Component target = e.getComponent();
        Container p = (Container)
            (target instanceof Container ? target : target.getParent());
        if (p != null) {
            p.postProcessKeyEvent(e);
        }
    }
    return true;
}
 
Example 14
Source File: IPV4Field.java    From lippen-network-tool with Apache License 2.0 5 votes vote down vote up
public void keyPressed(KeyEvent e) {
    JTextComponent field = (JTextComponent) e.getComponent();
    int keyCode = e.getKeyCode();
    char keyChar = e.getKeyChar();
    String text = field.getText();
    String selText = field.getSelectedText();
    int caretPos = field.getCaretPosition();
    int textLength = text.length();
    if ((keyCode == KeyEvent.VK_LEFT) && (caretPos == 0)
            && (selText == null)) {
        field.firePropertyChange("Left", 0, 1);
    } else if (((keyCode == KeyEvent.VK_RIGHT)
            && (caretPos == textLength) && (selText == null))
            || ((keyChar == '.') && (!text.isEmpty()) && (selText == null))) {
        field.firePropertyChange("Right", 0, 1);
    } else if ((keyCode == KeyEvent.VK_BACK_SPACE) && (caretPos == 0)
            && (selText == null)) {
        field.firePropertyChange("BackSpace", 0, 1);
    } else if ((keyCode == KeyEvent.VK_DELETE)
            && (caretPos == textLength) && (selText == null)) {
        field.firePropertyChange("Delete", 0, 1);
    } else if (keyCode == KeyEvent.VK_HOME) {
        IPV4Field.this.ipFields[0].unSelectAllWhenFocusGained();
        IPV4Field.this.ipFields[0].requestFocus();
        IPV4Field.this.ipFields[0].setCaretPosition(0);
    } else if (keyCode == KeyEvent.VK_END) {
        int last = IPV4Field.this.ipFields.length - 1;
        textLength = IPV4Field.this.ipFields[last].getText()
                .length();
        IPV4Field.this.ipFields[last]
                .unSelectAllWhenFocusGained();
        IPV4Field.this.ipFields[last].requestFocus();
        IPV4Field.this.ipFields[last]
                .setCaretPosition(textLength);
    } else if ((keyCode == KeyEvent.VK_0 || keyCode == KeyEvent.VK_NUMPAD0) && (caretPos == 0 || (text != null && text.equals(selText)))) {
        field.firePropertyChange("Right", 0, 1);
    } else if (("0123456789".indexOf(keyChar) >= 0)) {
        if (selText == null) {
            int ipInt = (text.length() == 0 ? 0 : Integer
                    .parseInt(text));

            if (ipInt > 25) {
                field.firePropertyChange("Right", 0, 1);
            }
        } else {
            if (field.getSelectionStart() == 2
                    && field.getSelectionEnd() == 3) {
                field.firePropertyChange("Right", 0, 1);
            }
        }
    }
}
 
Example 15
Source File: MainPanel.java    From java-swing-tips with MIT License 4 votes vote down vote up
private boolean isNavigationKey(KeyEvent event) {
  JTable table = (JTable) event.getComponent();
  InputMap inputMap = table.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
  KeyStroke key = KeyStroke.getKeyStrokeForEvent(event);
  return Objects.nonNull(inputMap) && Objects.nonNull(inputMap.get(key));
}
 
Example 16
Source File: DefaultKeyboardFocusManager.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Called by <code>dispatchEvent</code> if no other
 * KeyEventDispatcher in the dispatcher chain dispatched the KeyEvent, or
 * if no other KeyEventDispatchers are registered. If the event has not
 * been consumed, its target is enabled, and the focus owner is not null,
 * this method dispatches the event to its target. This method will also
 * subsequently dispatch the event to all registered
 * KeyEventPostProcessors. After all this operations are finished,
 * the event is passed to peers for processing.
 * <p>
 * In all cases, this method returns <code>true</code>, since
 * DefaultKeyboardFocusManager is designed so that neither
 * <code>dispatchEvent</code>, nor the AWT event dispatcher, should take
 * further action on the event in any situation.
 *
 * @param e the KeyEvent to be dispatched
 * @return <code>true</code>
 * @see Component#dispatchEvent
 */
public boolean dispatchKeyEvent(KeyEvent e) {
    Component focusOwner = (((AWTEvent)e).isPosted) ? getFocusOwner() : e.getComponent();

    if (focusOwner != null && focusOwner.isShowing() && focusOwner.canBeFocusOwner()) {
        if (!e.isConsumed()) {
            Component comp = e.getComponent();
            if (comp != null && comp.isEnabled()) {
                redispatchEvent(comp, e);
            }
        }
    }
    boolean stopPostProcessing = false;
    java.util.List<KeyEventPostProcessor> processors = getKeyEventPostProcessors();
    if (processors != null) {
        for (java.util.Iterator<KeyEventPostProcessor> iter = processors.iterator();
             !stopPostProcessing && iter.hasNext(); )
        {
            stopPostProcessing = iter.next().
                        postProcessKeyEvent(e);
        }
    }
    if (!stopPostProcessing) {
        postProcessKeyEvent(e);
    }

    // Allow the peer to process KeyEvent
    Component source = e.getComponent();
    ComponentPeer peer = source.getPeer();

    if (peer == null || peer instanceof LightweightPeer) {
        // if focus owner is lightweight then its native container
        // processes event
        Container target = source.getNativeContainer();
        if (target != null) {
            peer = target.getPeer();
        }
    }
    if (peer != null) {
        peer.handleEvent(e);
    }

    return true;
}
 
Example 17
Source File: DefaultKeyboardFocusManager.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Called by <code>dispatchEvent</code> if no other
 * KeyEventDispatcher in the dispatcher chain dispatched the KeyEvent, or
 * if no other KeyEventDispatchers are registered. If the event has not
 * been consumed, its target is enabled, and the focus owner is not null,
 * this method dispatches the event to its target. This method will also
 * subsequently dispatch the event to all registered
 * KeyEventPostProcessors. After all this operations are finished,
 * the event is passed to peers for processing.
 * <p>
 * In all cases, this method returns <code>true</code>, since
 * DefaultKeyboardFocusManager is designed so that neither
 * <code>dispatchEvent</code>, nor the AWT event dispatcher, should take
 * further action on the event in any situation.
 *
 * @param e the KeyEvent to be dispatched
 * @return <code>true</code>
 * @see Component#dispatchEvent
 */
public boolean dispatchKeyEvent(KeyEvent e) {
    Component focusOwner = (((AWTEvent)e).isPosted) ? getFocusOwner() : e.getComponent();

    if (focusOwner != null && focusOwner.isShowing() && focusOwner.canBeFocusOwner()) {
        if (!e.isConsumed()) {
            Component comp = e.getComponent();
            if (comp != null && comp.isEnabled()) {
                redispatchEvent(comp, e);
            }
        }
    }
    boolean stopPostProcessing = false;
    java.util.List<KeyEventPostProcessor> processors = getKeyEventPostProcessors();
    if (processors != null) {
        for (java.util.Iterator<KeyEventPostProcessor> iter = processors.iterator();
             !stopPostProcessing && iter.hasNext(); )
        {
            stopPostProcessing = iter.next().
                        postProcessKeyEvent(e);
        }
    }
    if (!stopPostProcessing) {
        postProcessKeyEvent(e);
    }

    // Allow the peer to process KeyEvent
    Component source = e.getComponent();
    ComponentPeer peer = source.getPeer();

    if (peer == null || peer instanceof LightweightPeer) {
        // if focus owner is lightweight then its native container
        // processes event
        Container target = source.getNativeContainer();
        if (target != null) {
            peer = target.getPeer();
        }
    }
    if (peer != null) {
        peer.handleEvent(e);
    }

    return true;
}
 
Example 18
Source File: DefaultKeyboardFocusManager.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Called by <code>dispatchEvent</code> if no other
 * KeyEventDispatcher in the dispatcher chain dispatched the KeyEvent, or
 * if no other KeyEventDispatchers are registered. If the event has not
 * been consumed, its target is enabled, and the focus owner is not null,
 * this method dispatches the event to its target. This method will also
 * subsequently dispatch the event to all registered
 * KeyEventPostProcessors. After all this operations are finished,
 * the event is passed to peers for processing.
 * <p>
 * In all cases, this method returns <code>true</code>, since
 * DefaultKeyboardFocusManager is designed so that neither
 * <code>dispatchEvent</code>, nor the AWT event dispatcher, should take
 * further action on the event in any situation.
 *
 * @param e the KeyEvent to be dispatched
 * @return <code>true</code>
 * @see Component#dispatchEvent
 */
public boolean dispatchKeyEvent(KeyEvent e) {
    Component focusOwner = (((AWTEvent)e).isPosted) ? getFocusOwner() : e.getComponent();

    if (focusOwner != null && focusOwner.isShowing() && focusOwner.canBeFocusOwner()) {
        if (!e.isConsumed()) {
            Component comp = e.getComponent();
            if (comp != null && comp.isEnabled()) {
                redispatchEvent(comp, e);
            }
        }
    }
    boolean stopPostProcessing = false;
    java.util.List<KeyEventPostProcessor> processors = getKeyEventPostProcessors();
    if (processors != null) {
        for (java.util.Iterator<KeyEventPostProcessor> iter = processors.iterator();
             !stopPostProcessing && iter.hasNext(); )
        {
            stopPostProcessing = iter.next().
                        postProcessKeyEvent(e);
        }
    }
    if (!stopPostProcessing) {
        postProcessKeyEvent(e);
    }

    // Allow the peer to process KeyEvent
    Component source = e.getComponent();
    ComponentPeer peer = source.getPeer();

    if (peer == null || peer instanceof LightweightPeer) {
        // if focus owner is lightweight then its native container
        // processes event
        Container target = source.getNativeContainer();
        if (target != null) {
            peer = target.getPeer();
        }
    }
    if (peer != null) {
        peer.handleEvent(e);
    }

    return true;
}
 
Example 19
Source File: DefaultKeyboardFocusManager.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Called by <code>dispatchEvent</code> if no other
 * KeyEventDispatcher in the dispatcher chain dispatched the KeyEvent, or
 * if no other KeyEventDispatchers are registered. If the event has not
 * been consumed, its target is enabled, and the focus owner is not null,
 * this method dispatches the event to its target. This method will also
 * subsequently dispatch the event to all registered
 * KeyEventPostProcessors. After all this operations are finished,
 * the event is passed to peers for processing.
 * <p>
 * In all cases, this method returns <code>true</code>, since
 * DefaultKeyboardFocusManager is designed so that neither
 * <code>dispatchEvent</code>, nor the AWT event dispatcher, should take
 * further action on the event in any situation.
 *
 * @param e the KeyEvent to be dispatched
 * @return <code>true</code>
 * @see Component#dispatchEvent
 */
public boolean dispatchKeyEvent(KeyEvent e) {
    Component focusOwner = (((AWTEvent)e).isPosted) ? getFocusOwner() : e.getComponent();

    if (focusOwner != null && focusOwner.isShowing() && focusOwner.canBeFocusOwner()) {
        if (!e.isConsumed()) {
            Component comp = e.getComponent();
            if (comp != null && comp.isEnabled()) {
                redispatchEvent(comp, e);
            }
        }
    }
    boolean stopPostProcessing = false;
    java.util.List<KeyEventPostProcessor> processors = getKeyEventPostProcessors();
    if (processors != null) {
        for (java.util.Iterator<KeyEventPostProcessor> iter = processors.iterator();
             !stopPostProcessing && iter.hasNext(); )
        {
            stopPostProcessing = iter.next().
                        postProcessKeyEvent(e);
        }
    }
    if (!stopPostProcessing) {
        postProcessKeyEvent(e);
    }

    // Allow the peer to process KeyEvent
    Component source = e.getComponent();
    ComponentPeer peer = source.getPeer();

    if (peer == null || peer instanceof LightweightPeer) {
        // if focus owner is lightweight then its native container
        // processes event
        Container target = source.getNativeContainer();
        if (target != null) {
            peer = target.getPeer();
        }
    }
    if (peer != null) {
        peer.handleEvent(e);
    }

    return true;
}
 
Example 20
Source File: DefaultKeyboardFocusManager.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Called by <code>dispatchEvent</code> if no other
 * KeyEventDispatcher in the dispatcher chain dispatched the KeyEvent, or
 * if no other KeyEventDispatchers are registered. If the event has not
 * been consumed, its target is enabled, and the focus owner is not null,
 * this method dispatches the event to its target. This method will also
 * subsequently dispatch the event to all registered
 * KeyEventPostProcessors. After all this operations are finished,
 * the event is passed to peers for processing.
 * <p>
 * In all cases, this method returns <code>true</code>, since
 * DefaultKeyboardFocusManager is designed so that neither
 * <code>dispatchEvent</code>, nor the AWT event dispatcher, should take
 * further action on the event in any situation.
 *
 * @param e the KeyEvent to be dispatched
 * @return <code>true</code>
 * @see Component#dispatchEvent
 */
public boolean dispatchKeyEvent(KeyEvent e) {
    Component focusOwner = (((AWTEvent)e).isPosted) ? getFocusOwner() : e.getComponent();

    if (focusOwner != null && focusOwner.isShowing() && focusOwner.canBeFocusOwner()) {
        if (!e.isConsumed()) {
            Component comp = e.getComponent();
            if (comp != null && comp.isEnabled()) {
                redispatchEvent(comp, e);
            }
        }
    }
    boolean stopPostProcessing = false;
    java.util.List<KeyEventPostProcessor> processors = getKeyEventPostProcessors();
    if (processors != null) {
        for (java.util.Iterator<KeyEventPostProcessor> iter = processors.iterator();
             !stopPostProcessing && iter.hasNext(); )
        {
            stopPostProcessing = iter.next().
                        postProcessKeyEvent(e);
        }
    }
    if (!stopPostProcessing) {
        postProcessKeyEvent(e);
    }

    // Allow the peer to process KeyEvent
    Component source = e.getComponent();
    ComponentPeer peer = source.getPeer();

    if (peer == null || peer instanceof LightweightPeer) {
        // if focus owner is lightweight then its native container
        // processes event
        Container target = source.getNativeContainer();
        if (target != null) {
            peer = target.getPeer();
        }
    }
    if (peer != null) {
        peer.handleEvent(e);
    }

    return true;
}