
I did a quick hack to get something close to what I really want and share it.
It is a small java program, time required to reach the target is displayed right (yellow bars) targets are red. To leave scroll the mouse wheel. I hope my answer isn't off-topic.
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.HeadlessException;
import java.awt.Toolkit;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Random;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class MTrainer extends JFrame {
Random rand = new Random();
int currPos, width, height, count;
int BLOCK_SIZE = 8;
Color[] blocks;
MTrainer mt;
ArrayList<Integer> times = new ArrayList<Integer>();
long start;
public MTrainer() throws HeadlessException {
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setUndecorated(true);
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
width = screenSize.width / BLOCK_SIZE;
height = screenSize.height / BLOCK_SIZE;
count = width * height;
blocks = new Color[count];
Arrays.fill(blocks, Color.BLACK);
setBounds(0, 0, screenSize.width, screenSize.height);
MPanel mPanel = new MPanel();
mPanel.addMouseMotionListener(mPanel);
mPanel.addMouseWheelListener(mPanel);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
getContentPane().add(mPanel);
}
class MPanel extends JPanel implements MouseMotionListener, MouseWheelListener {
public void paintComponent(Graphics g) {
for (int pos = 0; pos < count; pos++) {
int x = (pos) % width;
int y = (pos) / width;
g.setColor(blocks[pos]);
g.fill3DRect(x * BLOCK_SIZE, y * BLOCK_SIZE, BLOCK_SIZE,
BLOCK_SIZE, true);
}
int line = 0;
g.setColor(Color.YELLOW);
for (int w : times) {
g.drawLine(width * BLOCK_SIZE - Math.min(1000, w / 10), line,
width * BLOCK_SIZE - 1, line);
line++;
}
g.setColor(Color.BLACK);
}
public void mouseDragged(MouseEvent e) {
}
public void mouseMoved(MouseEvent e) {
int x = e.getX();
int y = e.getY();
int idx = x / BLOCK_SIZE + (y / BLOCK_SIZE) * width;
if (idx == currPos) {
int diff = (int) (System.currentTimeMillis() - start);
if (times.size() == height) {
times.remove(0);
}
times.add(diff);
blocks[currPos] = Color.BLUE;
do {
currPos = rand.nextInt();
} while (currPos > count || currPos < 0
|| blocks[currPos] == Color.BLUE);
start = System.currentTimeMillis();
blocks[currPos] = Color.RED;
}
repaint();
}
@Override
public void mouseWheelMoved(MouseWheelEvent arg0) {
if (arg0.getButton() != MouseEvent.BUTTON1) {
System.exit(0);
}
}
}
public static void main(String[] args) {
MTrainer mt = new MTrainer();
mt.currPos = mt.rand.nextInt(37);
mt.blocks[mt.currPos] = Color.RED;
mt.start = System.currentTimeMillis();
mt.setVisible(true);
}
}