tags:

views:

61

answers:

2

I want to know how can we perform action when mouse is double clicked in a component.

+5  A: 
public void mouseClicked(MouseEvent event)
{
  if (event.getClickCount() == 2) {
    System.out.println("double clicked)";
  }
}
kaliatech
+2  A: 

Assuming you mean in Swing, assign a MouseListener to your Component:

addMouseListener(new MouseAdapter(){
    @Override
    public void mouseClicked(MouseEvent e){
        if(e.getClickCount()==2){
            // your code here
        }
    }
});

Reference:

seanizer