Adding a background image to a JSpinner

The client wants a background image on the JSpinner so that the numbers are in black but the background is an image rather than a color. I know how to change the background color using the default editor but I don't know how to apply an image.Has anyone done this?

I would need to do the same thing for an jformattedTextField as well but I figure if I can learn to do it for a JSpinner, doing it for the text field would be a piece of cake.

[454 byte] By [Dean_Murraya] at [2007-11-27 4:34:46]
# 1

> but I figure if I can learn to do it for a JSpinner, doing it for the text field would be a piece of cake.

Your right, once you understand the concept its easy to add a background image for any component. So try searching the forum for postings on this topic. There are two general solutions:

a) override paintComponent(...) to draw the image

b) use an custom Border that paints an image as the background

camickra at 2007-7-12 9:44:44 > top of Java-index,Desktop,Core GUI APIs...
# 2
Thanks for the response. Actually after posting the question, I found the information I needed to get me started. I created a class (extending from JFormattedTextField) and overrode the paintComponent method where I drew the image and necessary text.
Dean_Murraya at 2007-7-12 9:44:44 > top of Java-index,Desktop,Core GUI APIs...