public static void installMouseListenerOnAllComponents(MouseListener m,Container c){
  c.addMouseListener(m);
  Component[] components=c.getComponents();
  for (int i=0; i < components.length; i++) {
    if (components[i] instanceof Container) {
      MouseInputAdapterInstaller.installMouseListenerOnAllComponents(m,(Container)components[i]);
    }
 else {
      c.addMouseListener(m);
    }
  }
}

public static void installMouseListenerOnAllComponents ( MouseListener m , Container c ) { c . addMouseListener ( m ) ; Component [ ] components = c . getComponents ( ) ; for ( int i = 0 ; i < components . length ; i ++ ) { if ( components [ i ] instanceof Container ) { MouseInputAdapterInstaller . installMouseListenerOnAllComponents ( m , ( Container ) components [ i ] ) ; } else { c . addMouseListener ( m ) ; } } }
add a mouselistener to all components .
