mouselistener

Java MouseListener

I have a bunch of JLabels and i would like to trap mouse click events. at the moment i am having to use: public void mouseClicked(MouseEvent arg0) { } public void mouseExited(MouseEvent arg0) { } public void mouseEntered(MouseEvent arg0) { } public void mousePressed(MouseEvent arg0) { } public void mouseReleased(MouseEvent arg0)...

Problem with MouseListener on multiple JLabels

I have 5 JLabels inside a JPanel which is inside a JFrame. I am adding the JLabels using a for loop which iterates through an array of Colors: private JLabel target; // This is the origin of the first label added. Point origin = new Point(10, 20); // This is the offset for computing the origin for the next label. int offset = 200; f...

Weird behavior of a MouseListener added to a JTable

I've hooked up a mouse listener to a JTable to call some stuff when mouse cursor leaves table's bounds. However, mouseExited() method is also called when the mouse cursor is leaving individual cells of a table. Is it some strange quirk in my code or a bug in Swing? EDIT: I didn't mention that my table is a subclass of a JTable and not a...