classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] FYI: fixed keyboard focus handling in java.awt.DefaultKeybo


From: Roman Kennke
Subject: [cp-patches] FYI: fixed keyboard focus handling in java.awt.DefaultKeyboardFocusManager
Date: Fri, 20 May 2005 21:26:45 +0200

Hi,

the DefaultKeyboardFocusManager as it was implemented had a serious
problem: it recognized the KEY_PRESSED and KEY_RELEASED event for
focusTraversalKeys and consumed them properly. BUT it did not recognize
the KEY_TYPED event for the same key and let it go through the
component. This ended up in TAB characters appearing in text components
when shifting focus with TAB for example. The problem here is, that
KEY_TYPED events are different than KEY_PRESSED and KEY_RELEASED (the
former carry the character for the key, the latter the key codes VK_*).
So the mapping is not straightforward and probably not even always
possible. What I implemented is that all KEY_TYPED events that follow a
KEY_PRESSED event for a focusTraversalKey are swallowed until the
corresponding KEY_RELEASED event is received. I think that this is ok
so.

2005-05-20  Roman Kennke  <address@hidden>

        * java/awt/DefaultKeyboardFocusManager.java
        (processKeyEvent): Properly swallow KEY_TYPED events after
        a KEY_PRESSED event for a focusTraversalKey has been received.
        Otherwise the focusTraversalKey (e.g. a TAB) would end up
        beeing delivered to the focused component.

/Roman

Attachment: DefaultKeyboardFocusManager.diff
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]