Duplicate :
|
JDK Version: jdk1.2, jdk1.2.2 OS: Win98 Locale: zh, C JDK1.2 provides a scheme, AWTEventListener, to catch awt event that been dispatched to system event queue. In win32 platform, if the gui component is swing, such as, JTextArea, the KEY_TYPED key event will be missed by AWTEventListener, so the event record tool based on this rule will lose KEY_TYPED event on swing components. Attahced is two short programs, one is to awt, the other is to swing. In them, we implement AWTEventListener, and add it to monitor system event dispatching, we got the following results: o In Solaris 2.6 platform: For awt, if we type 'a' once in TextArea, we got one KEY_PRESSED KeyEvent and one KEY_TYPED KeyEvent. For swing, if we typed 'a' once in JTextArea, we got two KEY_PRESSED KeyEvents and one KEY_TYPED KeyEvent. o In Win98 platform: For awt, if we type 'a' once in TextArea, we got one KEY_PRESSED KeyEvent and one KEY_TYPED KeyEvent. For swing, if we typed 'a' once in JTextArea, we only got two KEY_PRESSED KeyEvents, no KEY_TYPED KeyEvent was catched. jim.hu@prc 1999-06-09