← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #293629]: Imports not working when executing Sikuli/Jython from Java via ObjectFactory

 

Question #293629 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/293629

    Status: Open => Answered

RaiMan proposed the following answer:
in Germany we have a saying:
You do not see the wood because of all trees.

rather easy and obvious:
Caused by: java.lang.IllegalThreadStateException: Cannot call method from the event dispatcher thread
	at java.awt.Robot.checkNotDispatchThread(Unknown Source)

.. a well known problem with Swing and AWT:
to use actions like click which are based on Java awt Robot class you have to process the tasks under the hood of the Java event dispatch thread, meaning, that you cannot use click in code, that is triggered in a button handling method.

There are tons of information in the net about the background and
possible solutions.

The general guideline is, to take care somehow, that the mouseClicked
event handler returns as soon as possible, without doing anything that
conflicts with the event dispatcher (e.g. run the script in a completely
separated process).

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.