I have encountered a huge problem. I am trying to set the cursor on a JButton object to Cursor.HAND_CURSOR from the default state when the mouse
enters the object in question but somehow it fails. The buttons enability is set to false and at first i was wondering if the cause to the problem had
something to do with that but previously in the application i have managed to set the cursor to different states but in this case it doesn't work anymore.
I am just wondering if anyone else has encountered this very same problem and what would be the general solution for this?
The code for my JButton object looks like this:
Any hints or thoughts are greatly much appreciated!
This is my MouseListener method that i use on the JButton object in question:
The MouseListener is implemented by a class called CompanyInfoPanel. Many thanks for the reply.
posted 1 month ago
well, I see nothing wrong with your code. I copied it as much as I could, but it worked flawlessly. And enabling/disabling of the button does not matter for the working of the MouseListener, as you write. The only two things that I can think of, without knowing your code, is that there are circumstances where the icon is null (what has the icon got to do with this though?), or that you somehow have removed the MouseListner. Can you see if one of these happens somewhere?