dcsimg
Can I disable a button but without having it in grey ?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Pep_Grifell
Posted On:   Monday, February 10, 2003 06:42 AM

Hi,


I have a button that is an image (icon). When I disable it, the image becomes grey, but I donĀ“t like it. There is any way to disable the button and mantain the same image in the button ?



Thanks !

Re: Can I disable a button but without having it in grey ?

Posted By:   Bahman_Barzideh  
Posted On:   Monday, February 10, 2003 07:45 AM

I assume your button is implemented as a JButton. If so, you may be
able to accomplish your goal by specifically setting its disabled image
icon to the same image as its normal image icon. something like:

ImageIcon image = new ImageIcon ("some/file.png");
JButton button = new JButton (image);
button.setDisabledIcon (image);

You should note that this only impacts the image for the button. the rest
of the button (its border, its text, etc) will be renedered as being disabled.
About | Sitemap | Contact