Hi, I wish to write a java program that runs on an undecorated jFrame that detects mouse events.
I already have one of these but I have run into a problem.
I have a sub-program that essentially functions like a sliding bar. After you click on it, it begins to track the location of the mouse using a thread. If you let go of the mouse or move the mouse across the screen, as opposed to dragging, it ends the thread. The problem is that the thread canít tell when the mouse is released until after the mouse re-enters the JFrame. Because of this, the sliding barís position keeps changing and if you were to let go and then repress the mouse outside of the screen, the screen would continue to run the thread.
I have two ideas that may let me get around this. First, I could set the thread to automatically end if the mouse exits but I would rather not have the mouse accidentally let go all the time.
I could also set the thread to end when focus is lost but the thread would continue to track the unheld button until it was clicked again I think.