i am trying to put a picture on the top of my swing GUI that stretches horizontally to fit the width of the window as it resizes
http://www.camick.com/java/source/BackgroundPanel.java
this is the code for a commonly used function that scales images to their components size. it works by overloading the paintcontainer class, which is called every time the window resizes, which then calls the paint class. they simply grab the size of the container and draw the image to those dimensions
the image that needs to be resized must be placed in BorderLayout.NORTH, because the rest of my GUI is in BorderLayout.CENTER, but BackgroundPanel cant be placed in NORTH, the image disappears, even with a minimum size set. it cant be placed inside a panel inside a panel inside NORTH either. ive been reading over the code for BackgroundPanel and its driving me crazy i cant figure out why
here is some short example code, not my program but it simplifies the problem: