how to dynamically resize the background image of a JPanel as the size of window changes
Joined: Jun 14, 2011
i have just successfully added a background image to a JPanel by overriding the paintComponent method, however i realized that each time i maximize the window containing the JPanel, the image doesnt re-adjust to completely fill up the the window. The size of the background image remains static irrespective of the size of the window. i want the background image to dynamically fill up the the JPanel each time the window is resized.
Thanks in advance for your assistance
Joined: Jun 09, 2003
is it the panel, or the image, that is not resizing?
if the panel, use a correct layout manager.
if the image, use the correct parameters
i.e. panel has getWidth() and getHeight()