I’m not sure if theres a better way to do what you want, but one solution I can think of is to use a paintable canvas component. There, you can use the Java graphics drawImage() function and do some calculations so you make make the image the right size and then draw it.