From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27573 invoked by alias); 25 Sep 2007 19:27:11 -0000 Received: (qmail 27565 invoked by uid 22791); 25 Sep 2007 19:27:11 -0000 X-Spam-Check-By: sourceware.org Received: from brmea-mail-3.Sun.COM (HELO brmea-mail-3.sun.com) (192.18.98.34) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 25 Sep 2007 19:27:08 +0000 Received: from fe-amer-09.sun.com ([192.18.109.79]) by brmea-mail-3.sun.com (8.13.6+Sun/8.12.9) with ESMTP id l8PJR6eD007631 for ; Tue, 25 Sep 2007 19:27:07 GMT Received: from conversion-daemon.mail-amer.sun.com by mail-amer.sun.com (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007)) id <0JOX00A01UOAZA00@mail-amer.sun.com> (original mail from David.Herron@Sun.COM) for mauve-discuss@sources.redhat.com; Tue, 25 Sep 2007 13:27:06 -0600 (MDT) Received: from [129.145.161.155] by mail-amer.sun.com (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007)) with ESMTPSA id <0JOX00D5SVCWIR80@mail-amer.sun.com>; Tue, 25 Sep 2007 13:26:57 -0600 (MDT) Date: Tue, 25 Sep 2007 19:27:00 -0000 From: David Herron Subject: Re: Tweaking default java.awt.Robot settings In-reply-to: <46F95489.3080101@redhat.com> To: Lillian Angel Cc: =?UTF-8?B?U3RldmUgTWNLYXnimIQ=?= , mauve-discuss@sources.redhat.com Message-id: <46F96193.7080202@sun.com> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=UTF-8 Content-transfer-encoding: 7BIT References: <4f2ee4520709241331o1a77379cudffb314dc1622914@mail.gmail.com> <46F8238C.8020606@sun.com> <4f2ee4520709241422n5ca2cf60g8d37fb76a27d4067@mail.gmail.com> <46F82F8D.6040404@sun.com> <46F95489.3080101@redhat.com> User-Agent: Thunderbird 1.5.0.13 (X11/20070824) X-IsSubscribed: yes Mailing-List: contact mauve-discuss-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: mauve-discuss-owner@sourceware.org X-SW-Source: 2007-q3/txt/msg00033.txt.bz2 Lillian Angel wrote: > David Herron wrote: >> [resending because the mailing list thingy told me I had to use only >> plain text messages...] >> >> Hmmm.. here's the meat of the test >> >> public void runTest(int code, char chr) >> { >> KeyEvent e = new KeyEvent(f, KeyEvent.KEY_PRESSED, 0, 0, code, >> chr, KeyEvent.KEY_LOCATION_STANDARD); >> f.dispatchEvent(e); >> f.setSize(200,200); >> f.show(); >> r.mouseMove(60, 60); >> >> r.keyPress(code); >> r.keyRelease(code); >> h.check(key, (int) chr); >> } >> >> I don't understand this. If you're going to create a Java event why >> use Robot, or vice versa...? > > The test was done this way to determine if the right key was pressed. > See the inner class (myFrame) which has 1 function (keyDown) which > sets a variable (key) to the key that was pressed. > > While it might be incorrect, I am unsure how else we can determine > that the correct key was pressed without dispatching an event. > > Lillian > Maybe I misread the code in my brief look. The side effect of using Robot to keyPress and keyRelease should be the dispatch of two KeyEvent's. That's why I said those two lines should go, because the way I read it they're masking whether Robot successfully delivered the KeyEvent's. - David Herron