The change in colour from black text to grey text is the usual behaviour of disabled buttons in most platforms. You can probably try changing background colour, transparency, etc. Or somebody else will know exactly what to do.
Rob is right, helping someone and getting no feedback whatsoever can be frustrating. But this site should be friendly to all, so lets give it another go.
If you look at the API of class AbstractButton (of which the JButton is extended), you will find a method that deals with setting an icon in case the Button gets disabled. Now, you can use the same icon that is also used as the enabled icon, but that has the problem that Rob described (the user has no indication of the button being disabled). So this is also a nice way: make a copy of the enabled icon, draw a big red X over it, and set it as the disabled icon.
posted 5 months ago
Thanks for your replies everyone, and for bringing that up Rob which I was unaware of. I'm really sorry!, it wasn't my intention to seem ungrateful, I am very grateful for all comments! When looking through other sites like stack overflow it says not to post comments that only say "thanks etc" so I just assumed it was the same for here. But I will reply to all my previous posts now so other users who may encounter these problems will know which solution worked
Also thanks Plet, I've used the .setDisabledIcon() method, it still darkens the image a bit but not so much as the default
Caiz wrote:Also thanks Plet, I've used the .setDisabledIcon() method, it still darkens the image a bit but not so much as the default
Hmm, it is quite a while ago since I did anything like this, so maybe my memory is playing tricks. I'll have a look at it and will let you know. But maybe Rob had a better way in mind, so let's hope he will let us know.
posted 5 months ago
I have used code like the following:
To me the icon is painted the same.
The difference I notice is that the background has changed.
Maybe a different solution would be to replace the button with a JLabel when you want to disable the button.