how to dynamically resize the background image of a JPanel as the size of window changes
aity myles
Greenhorn
Joined: Jun 14, 2011
Posts: 11
posted
0
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
Michael Dunn
Ranch Hand
Joined: Jun 09, 2003
Posts: 4632
posted
0
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()