← Back to team overview

sikuli-driver team mailing list archive

[Question #206505]: extends Screen will make it work but why...

 

New question #206505 on Sikuli:
https://answers.launchpad.net/sikuli/+question/206505

Hi RaiMen,

It's me again...I am trying to make my extension working now,

In the first case, I kind of wrote it like this,

public class extendFuncs extends Region{
	public int GetHome() throws Exception{
		int i;
		for(i=0;i<3;i++){
			type(Key.ESC);
			wait(2.0);
		}
		return 0;
	}
}

And while executing my script, I got a null Pointer exception. I guess it's caused by _robot(right?).
So I modified the code like this in order to initialize _robot, in the second case,

public class extendFuncs extends Region{
	public extendFuncs(){
		Rectangle r = new Screen().getBounds();
		Region.create((int)(r.getX()), (int)(r.getY()), (int)(r.width), (int)(r.height));
	}

	public int GetHome() throws Exception{
		int i;
		for(i=0;i<3;i++){
			this.type(Key.ESC);
			this.wait(2.0);
		}
		return 0;
	}
}

And now, I will get a FindFailed exception...
Finally, I wrote it like this, in the third case,

public class extendFuncs extends Screen{
	public int GetHome() throws Exception{
		int i;
		for(i=0;i<3;i++){
			type(Key.ESC);
			wait(2.0);
		}
		return 0;
	}
}

and now it's working but why? I notice that class screen extends class region but _robot is private...

As a starter of Java, I am almost lost now...

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.