Hide mouse cursor during the experiment

Ask questions and discuss programming issues around Tatool Java.
Posts: 16
Joined: Fri Aug 31, 2012 8:04 am
Institution: University of Fribourg

Hide mouse cursor during the experiment

Post by mouthonm » Wed Sep 19, 2012 1:34 am

Is there a way to hide the mouse pointer during the experiment ?

Posts: 259
Joined: Tue Apr 24, 2012 12:56 pm
Institution: Tatool

Re: Hide mouse cursor during the experiment

Post by alocher » Wed Sep 19, 2012 10:03 am

Unfortunately that's not as easy to implement right now as it should be. We would like to add this feature in a future version of Tatool.

Until then you could try something like this (copied from this link http://stackoverflow.com/questions/1984 ... pplication):

Code: Select all

w.setCursor( w.getToolkit().createCustomCursor( new BufferedImage( 1, 1, BufferedImage.TYPE_INT_ARGB ), new Point(), null ) );
The only problem is that you don't have access to the window/frame and therefore you will have to set the cursor to all panels being displayed with the regionContainer (works only on Content and Action panels not on Status panels).

Posts: 13
Joined: Sat Jan 26, 2013 9:30 am
Institution: cardiff university

Re: Hide mouse cursor during the experiment

Post by saprca » Fri Aug 16, 2013 7:44 am

As the mouse cursor appeared in the ITI between trials using this method I also added code to move the cursor to the top right hand corner:

Dimension screensize = Toolkit.getDefaultToolkit().getScreenSize();
width = screensize.width;
Robot robot = new Robot();
robot.mouseMove(width,0); // set the cursor in top right corner

Posts: 39
Joined: Fri Mar 07, 2014 6:21 am
Institution: University of Zurich

Re: Hide mouse cursor during the experiment

Post by a.rey-mermet » Tue Nov 18, 2014 1:24 am


Is there a way to hide the mouse cursor not only during the experiment but also during the instructions?


Site Admin
Posts: 10
Joined: Sun Apr 22, 2012 1:11 pm

Re: Hide mouse cursor during the experiment

Post by tatool » Wed Nov 19, 2014 4:08 pm

There's at least two ways I can think of on how to achieve what you're looking for. The easiest way is probably that you just use saprca's code above at the end of an Executable running upfront, so the cursor gets moved to the top right and is therefore invisible. This of course only works if you have some executable ahead of the instructions and if you don't allow people to use the mouse at all during an experiment.
If that doesn't work, you'll have to create your own Instruction Executable by coying the AbstractHTMLExecutable code (https://www.assembla.com/code/tatool/su ... table.java). Within your code you can then add either or both code snippets from above to hide the cursor. After copying the AbstractHTMLExecutable make sure to remove the "abstract" modifier (public class MyHTMLExecutable...) for your class as you won't be able to instantiate it otherwise.


Who is online

Users browsing this forum: No registered users and 1 guest