title: Differentiate between keyboard/mouse events and Java Robot events
body: <p>In Java, you can listen for key/mouse events generated by the user keyboard/mouse. Also, Java allows you to generate key/mouse events using the <code>java.awt.Robot</code>, and these events can be captured by the same listeners. How can you differentiate between events generated by the user keyboard/mouse, and events generated by <code>java.awt.Robot</code>. I examined <code>event.getSource()</code>, but it seem that the event source for both is the same frame. Any other way to tell which one triggered the event?</p>
  
  <p><strong>Edit:</strong>
  Since this question is closed (cannot answer it), and the duplicate is not the answer. You can detect Robot events generated by your own application by setting a flag (multiple flags if needed) before generating the event using Robot, then check them when an event happen in the listener and rest them after handling them. This is not the best way, but it is possible. I was looking for a better way since it was in the same context of the application, but the one who closed the question made a rushed decision closing the question :( </p>