The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
October 2000



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.


Very Urgent ! Facing problems with KeyListener !!

Posted by Ujjwal Verma on October 23, 2000 at 9:16 PM

Actually i am making a Notepad and I have made mnemonics for the menus like "file -> f","edit ->e","search ->s" etc . Also I have applied Key listener to text area in the nootepad . In this Key listener I have overridden "keyTyped()" to check whether the text area is empty or even a single character has been typed in it . The problem which i am facing is whenever I press Alt+f to open the file menu , "f" gets written in the text area . Similarly whenever I press Alt+e to open edit menu , "e" gets written in the text area . The same problem is with other menus also .
The second problem which i am facing is that I have put a condition that if the text area is empty then certain menu items should get disabled . But even if a single character is written in the text area then it means that the text area is not empty . So those menu items should be activated now. But this does not happen . When I write the second character then those menu items get activated but not with the first character .

Kindly provide me a solution as soon as possible 'coz my project is pending due to thess problems .


Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us