dcsimg
JButton background image
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Alexander_Nordh
Posted On:   Thursday, June 21, 2007 07:58 AM

Is it possible to have an image as background in a JButton instead of a color?

Re: JButton background image

Posted By:   Robert_Lybarger  
Posted On:   Thursday, June 21, 2007 08:49 AM

Probably -- with the right method overrides (and patience), just about anything is possible in Swing. I'd recommend a subclass that stores an Image reference and overrides "paintComponent" method to first "g.drawImage" and then "g.drawString" on top of that. I don't *think* that the standard JButton can do this out of the box, but then I've been surprised before. (mumbles something about 'api bloat' ;)
About | Sitemap | Contact