I am trying to detect whether a key, e.g. control key, is pressed in java DropTargetDropEvent of dropping an OS file. Due to the focus change from OS file browser to application, my understanding is key detection without focus may be needed. Some said it is hard or impossible without focus, while some posted solutions and have been accepted. I tried the accepted solution, but as one comment said, it never returns true for key press. Anyone has any idea?
I also tried to use getDropAction of DropTargetDropEvent to detect control key. Under Windows and MAC I tested, it returns ACTION_COPY if control is down, and ACTION_MOVE if neither control nor shift is down. Unfortunately it returns ACTION_COPY under Linux no matter control key is down or not. Any idea to override the drop actions supported by the drag source so getDropAction won't return ACTION_COPY under Linux when control key is not down?
Any idea and suggestion are welcome.