ERROR: Cannot call method from the event dispatcher thread
Hello
I have a serious problem, I am writing code in Java with Eclipse to enter information in a web portal. But I get the ERROR: Can not call method from the dispatcher thread event.
I tried to add a thread to avoid the problem, but in this case pe will appear another [error] mouseDown: buttons still pressed - using all
Java.lang.
In the User entry, the cursor is positioned in the field, but does not write anything.
In the button click, the cursor is positioned and clicked, but does not perform the action.
I can not find a solution for more that I have looked for, you can help me.
This is my code
public class Main {
public static void main(String[] args) {
Fn.WriteLog(" Usuario");
error = Fn.TypeByImage(
if (error) {
errorText = "Error: Usuario";
return errorText;
}
Fn.WriteLog(" Iniciar Sesión");
//error = Fn.TypeByImage(
// TEST
new ThreadExperiment();
}
}
public static boolean TypeByImage(
boolean error = false;
try{
Screen screen = new Screen();
Pattern imagen = new Pattern(
screen.
try {
} catch (InterruptedExc
e.printStac
}
}catch(Exception err){
err.
Fn.WriteLog(
}
return error;
}
public static boolean ClickByImage(String Imagen){
boolean error = false;
Screen screen = new Screen();
Pattern imagen = new Pattern(
try{
try {
screen.
} catch (FindFailed e2) {
e2.
}
try {
screen.
} catch (FindFailed e1) {
// TODO Auto-generated catch block
e1.
}
try {
} catch (InterruptedExc
e.
}
}catch(Exception err){
err.
Fn.WriteLog(
}
return error;
}
import org.sikuli.
import org.sikuli.
import org.sikuli.
public class ThreadTest implements Runnable {
Thread t;
ThreadTest() {
// thread created
t = new Thread(this, "Admin Thread");
// prints thread created
// this will call run() function
t.start();
}
@Override
public void run() {
Screen screen = new Screen();
Pattern imagen = new Pattern(
try {
} catch (InterruptedExc
}
}
}
--ERROR DEBUG--
Usuario
[debug] Screen: initScreens: basic initialization (1 Screen(s) found)
[debug] *** monitor configuration (primary: 0) ***
[debug] Screen 0: S(0)[0,0 1680x1050]
[debug] *** end monitor configuration ***
[debug] waiting for P(//Portable Eclipse/
[debug] Screen.capture: java.awt.
[debug] RobotDesktop: captureScreen: on 0 using java.awt.
[debug] ResourceLoaderB
[debug] ResourceLoaderB
[debug] ResourceLoaderB
[debug] ResourceLoaderB
[debug] ResourceLoaderB
[debug] ResourceLoaderB
[debug] ResourceLoaderB
[debug] ResourceLoaderB
[debug] ResourceLoaderB
[debug] ResourceLoaderB
[debug] ResourceLoaderB
[debug] ResourceLoaderB
[debug] ResourceLoaderB
[debug] P(//Portable Eclipse/
[log] CLICK on L(850,239)@S(0)[0,0 1680x1050]
java.lang.
ERROR: Cannot call method from the event dispatcher thread
at java.awt.
at java.awt.
at org.sikuli.
at org.sikuli.
at org.sikuli.
at org.sikuli.
at org.sikuli.
at Clarity.
at Clarity.
at Clarity.
at Clarity.
at javax.swing.
at javax.swing.
at javax.swing.
at javax.swing.
at javax.swing.
at java.awt.
at javax.swing.
at java.awt.
at java.awt.
at java.awt.
at java.awt.
at java.awt.
at java.awt.
at java.awt.
at java.awt.
at java.awt.
at java.awt.
at java.awt.
at java.awt.
at java.awt.
at java.awt.
at java.awt.
at java.security.
at java.security.
at java.security.
at java.awt.
at java.awt.
at java.security.
at java.security.
at java.awt.
at java.awt.
at java.awt.
at java.awt.
at java.awt.
at java.awt.
at java.awt.
Iniciar Sesión
thread = Thread[Admin Thread,6,main]
Inside run()function
[debug] waiting for P(//Portable Eclipse/
[debug] Screen.capture: java.awt.
[debug] RobotDesktop: captureScreen: on 0 using java.awt.
[debug] P(//Portable Eclipse/
[log] CLICK on L(773,331)@S(0)[0,0 1680x1050]
[error] mouseDown: buttons still pressed - using all
Question information
- Language:
- English Edit question
- Status:
- Answered
- For:
- SikuliX Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask Antoni Illana for more information if necessary.