Java JLabel handle mouse move event
import java.awt.event.MouseEvent; import java.awt.event.MouseMotionListener; import javax.swing.JFrame; import javax.swing.JLabel; class CustomListener implements MouseMotionListener { public void mouseMoved(MouseEvent me) { System.out.println("mouseMoved"); }//from w w w. j a v a2 s . co m public void mouseDragged(MouseEvent me) { System.out.println("mouseDragged"); } } public class Main { public static void main(String[] a) { JFrame frame = new JFrame("Popup JComboBox"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JLabel label = new JLabel(); label.addMouseMotionListener(new CustomListener() { }); frame.add(label); frame.setSize(300, 200); frame.setVisible(true); } }