One way is to override the paintComponent(...)
method of a JPanel to paint the image using the drawImage(....)
method.
Another option is use a JLabel with an Icon as the background for the frame. Then you can use the Stretch Icon which will automatically scale based on the space available to the label. This is the most flexible solution since the StretchIcon
can be used on any component that supports icons.
You can also check out the Background Panel which allows you to display an image. You can display the image at its actual size, scaled or tiled.
solved Java Swings Auto-Resize Pictures