This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
I'm curious... is there any way i can add a "Mouseover" to a JLabel so that when the mouse is over it, the cursor changes to a hand-cursor? Thanks, Rock
hi, I think you can add a "mouseover" on a jlabel. To do so you will have to implement "MouseListener" class.Then to the respective label add the listener (.addMouseListener) and implement the required methods ("mouseOver" in your case).
Ummm... actually the interface you want to look at is MouseMotionListener... and the method you'll want to use is mouseMoved(). You could also try setting a boolean in mouseEntered() and unsetting it in mouseExited() of the MouseListener interface.
You could also use a JButton instead of a JLabel and use the built in methods - setRolloverEnabled(), setRolloverIcon(), etc.
-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
You can do this. Add a mouseListener to a JLabel and change the cursor on mouseEntered and mouseExited. I have a custom class that does just this - if anyone wants to see the code, let me know. Brian