Chris Nash wrote:Chris, Pete and I were telling you to do two different things. His suggestion is to extend JButton and implement your own paint routine. He says there is an isRollover() method you can call to check for rollover. In his case, you won't need a mouse listener.
Actually, I'm not a big fan of implementing his own paint routine as that steps on the look and feel's ability to paint the button. Rather, I thought that that was what the OP is trying to do. I guess what I/we really need is a detailed description of just what effect the OP is trying to create here because now I'm not so sure.
By the way, to the original poster, your latest code doesn't sit well with me, sorry. Again, I wouldn't use a MouseListener on a JButton or a descendant of a JButton. But more importantly, this is not kosher and looks to break easily:
You never call paintComponent directly.