As per your comment, Java doesn't make .exe files. You would need to place your jar file into a special executable wrapper to accomplish that. Launch4j can do that for you.
You would want to run your application as a Service. This SO Thread can shed some additional light on that subject.
In your application:
Set your clock component so that it is non-visible. Create a TimerTask to monitor the System Mouse pointer location (x, y). Utilize the MouseInfo Class within the TimerTask's run() method to track the Mouse Pointer location. Keep track of the time from the mouse last movement. If 10 minutes has elapsed with no mouse movement then display your clock (make it visible). If you like, when the mouse is moved again make the clock non-visible again. Your code in relation to this might look something like this:
First declare and initialize four (4) Class Member Variables:
int mouseX = 0;
int mouseY = 0;
long timeOfLastMovement = 0L;
TimerTask mouseMonitorTask;
Somewhere in your Class copy/paste this method. Make the required changes as you see fit:
private void startMouseMonitoring() {
mouseMonitorTask = new TimerTask() {
@Override
public void run() {
PointerInfo info = MouseInfo.getPointerInfo();
Point pointerLocation = info.getLocation();
long currentTime = java.lang.System.currentTimeMillis();
//System.out.format("Mouse Location - X: %d, Y: %d\n", pointerLocation.x, pointerLocation.y);
float elapsedTime = (((currentTime - timeOfLastMovement) / 1000F) / 60);
if (pointerLocation.x == mouseX && pointerLocation.y == mouseY) {
// Check if 10 minutes has elapsed with no mouse movement
if (elapsedTime >= 10.0f) {
/* Make Clock Visible if it isn't already
or whatever else you want to do. */
if (clockIsNonVisible) {
// clock.setVisible(true);
}
}
}
else {
mouseX = pointerLocation.x;
mouseY = pointerLocation.y;
timeOfLastMovement = currentTime;
// Make clock non-visible if you like.
if (clockIsVisible) {
// clock.setVisible(false);
}
}
try {
Thread.sleep(500);
}
catch (InterruptedException e) {
cancel();
e.printStackTrace();
}
}
};
Timer monitorTimer = new Timer("Timer");
long delay = 1000L; // Start Delay: 1 second
long period = 1000L; // Cycle every: 1 second
monitorTimer.scheduleAtFixedRate(mouseMonitorTask, delay, period);
}
Call the startMouseMonitoring() method and the ball is rolling. I'm sure you'll figure out the rest.
If you want to cancel the TimerTask and Mouse Monitoring then you can call the TimerTask#cancel() method:
mouseMonitorTask.cancel();