|
If the user clicks the button with the mouse, that button gets the focus. As Javadocs of Robot.click says, it Simulates a user clicking once the given Component using the left mouse button. I wonder if there's a way for the BasicRobot.focus to wait until the focus has been transferred and all registered listeners have been notified. Or perhaps the current implementation already does that? Perhaps BasicRobot.click should call focus(c, true)? Thanks I don't think BasicRobot.click should call BasicRobot.focus. 'click' should automatically give focus to the component once the mouse is pressed. It works just like when a user clicks. The user does not give focus to the component before clicking it. He/she simply hovers the mouse over the component and presses and releases the left mouse button. That is what the Robot simulates. Therefore the call to 'focus' is unnecessary. So the focus will be on the component after the Robot.click is done? |
||||||||||||||||||||||||||||||||||||||
IMHO, 'click' should not give focus to the component before actually pressing the mouse button.