changing JButton image upon clicking

Hello,

I want to have a JButton's image change when it it clicked. I don't want it to just change for the click, but to remain the changed picture after the click. So I'm not looking for a method like "setPressedIcon." I would think that I could change the image by using setIcon in the action listener when the button is pressed, but it wasn't working. When I tried doing that, the picture just disappeared when I clicked the button and then after there was no picture at all. Is there something I'm missing? Or a better way to approach this?

I want to have a JButton's image change when it it clicked. I don't want it to just change for the click, but to remain the changed picture after the click. So I'm not looking for a method like "setPressedIcon." I would think that I could change the image by using setIcon in the action listener when the button is pressed, but it wasn't working. When I tried doing that, the picture just disappeared when I clicked the button and then after there was no picture at all. Is there something I'm missing? Or a better way to approach this?

Yeah, we need to see code to see where your mistakes are, otherwise it will be difficult to help you. Please look at my link on how to create an SSCCE to see just what type of code we need to see.