Hi folks, I need to display a jpeg on a JPanel. I need it as a background, no other components will be on this JPanel. I have tried to set the jpeg as the icon for a JLabel that takes the entire size of JPanel but the dimensions of the jpeg are too small. I need the jpeg to take up the entire JPanel no matter what the screen resolution is set to. Could someone give the code on how to do this or at least point me in the right direction? Thanks!!
Jason R. Kretzer<br />Software Engineer<br />System Administrator<br /><a href="http://alia.iwarp.com" target="_blank" rel="nofollow">http://alia.iwarp.com</a>
Joined: Feb 22, 2001
I think this should work for you:
You can look at the API for Image to see more options for the getScaledInstance method. I used the SCALE_SMOOTH property in this example, but there are other options that use different scaling algorithms.