This is the mail archive of the mauve-discuss@sourceware.org mailing list for the Mauve project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Tweaking default java.awt.Robot settings


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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]