Reputation: 37
how to make single click action to work as double click, in windows we have functionality like when we click on folder it will open on single click.in java is there is any way to do it?
on one click it should select the folder and open the folder.
Upvotes: 2
Views: 807
Reputation: 303
You should generate a double-click event from the "single-click" handler.
Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(
new MouseEvent( Component,MouseEvent.MOUSE_CLICKED,_,_,_,_,2,_) );
See MouseEvent for the meaning of all the parameters - the underscores are things you have to fill and the two is the number of clicks. Remember that you can use most of information received in the event object in the single-click handler and just change the number of clicks.
Upvotes: 3