|
|
Classification: |
Java |
Category: |
AWT |
Created: |
01/31/2001 |
Modified: |
09/02/2001 |
Number: |
FAQ-0565 |
Platform: |
ER5 |
|
Question: I have a frame with a TextField that implements the KeyListener interface. When a password is typed in the TextField and
the "enter" key pressed the keyPressed method is invoked and creates a new Dialog. This appears momentarily but then disappears.
I believe the key pressed KeyEvent is not being consumed by the keyPressed method and is consequently prematurely triggering
the actionPerformed method of my Dialog which diposes of my window. Is this so? (The Dialog implements the ActionListener interface, the actionPerformed method being used, among other things, to dispose
of the Dialog ).
Answer: The KeyEvent of the TextField is not consumed as it should be by the keyPressed method. The Dialog is created on entering
the password but the unconsumed KeyEvent (with code VK_ENTER) triggers the actionPerfomed method of the Dialog causing the
Dialog to be disposed of. This defect has been fixed for v6.0 of Symbian OS. A work around is to use the keyReleased method to create the Dialog.
|
|
|