src/java.desktop/share/classes/java/awt/DefaultKeyboardFocusManager.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 794,804 ****
*
* @param e the KeyEvent to be dispatched
* @return <code>true</code>
* @see Component#dispatchEvent
*/
- @SuppressWarnings("deprecation")
public boolean dispatchKeyEvent(KeyEvent e) {
Component focusOwner = (((AWTEvent)e).isPosted) ? getFocusOwner() : e.getComponent();
if (focusOwner != null && focusOwner.isShowing() && focusOwner.canBeFocusOwner()) {
if (!e.isConsumed()) {
--- 794,803 ----
*** 822,839 ****
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);
}
--- 821,838 ----
postProcessKeyEvent(e);
}
// Allow the peer to process KeyEvent
Component source = e.getComponent();
! ComponentPeer peer = source.peer;
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.peer;
}
}
if (peer != null) {
peer.handleEvent(e);
}
*** 1047,1057 ****
*/
if (KeyboardFocusManager.isProxyActive(ke)) {
Component source = (Component)ke.getSource();
Container target = source.getNativeContainer();
if (target != null) {
! ComponentPeer peer = target.getPeer();
if (peer != null) {
peer.handleEvent(ke);
/**
* Fix for 4478780 - consume event after it was dispatched by peer.
*/
--- 1046,1056 ----
*/
if (KeyboardFocusManager.isProxyActive(ke)) {
Component source = (Component)ke.getSource();
Container target = source.getNativeContainer();
if (target != null) {
! ComponentPeer peer = target.peer;
if (peer != null) {
peer.handleEvent(ke);
/**
* Fix for 4478780 - consume event after it was dispatched by peer.
*/