I believe this is the right section for this, the Swing section looked like it was for questions rather than problems in code.

Hi, in my program I have a JFrame (with a borderlayout) with one jpanel on it (borderlayout.NORTH), which in the pictures below is the top section with the two buttons. When the user clicks a button, a jpanel is added (borderLayout.SOUTH) below the menu one. For some reason, when you expand the jframe window there is a second jpanel below the first one (that was just added. This second jpanel's dimensions scale with the size of the JFrame window, while the first jpanel stays in place no matter how the window is scaled.

On the jpanel there is a button in which lets you choose a file. When you do choose a file, a jlabel beside the button displays the path of the file. However whether you click the "choose file" button on the top or bottom jpanel, the path text is only displayed on the bottom jpanel.

I also added a JCheckbox to my jpanel, after displaying it on the jframe, then using the pack() method again. When I did this the checkbox was only displayed on the second (bottom) jpanel and not the first(top).

If my description isn't clear I provided a download link (its 20KB) , or if you're not comfortable downloading anything, I have pictures too.

Any help is appreciated, thanks!

I left in all the code (just in case) but what I think is the only relevant code is added beside my links

Code:
[Java] package musicdownloader; import java.awt.*; import javax.swing.*; import java - Pastebin.com
Relevant code: Lines 89 - 97 in my pastebin link
private class menuActionListener implements ActionListener{
        public void actionPerformed(ActionEvent e){
            String eventName = e.getActionCommand();
 
            switch(eventName){
                case "downloadMusic":{
                    dPanel = new DownloadPanel(windowLength,150,new downloadActionListener());
                    add(dPanel,BorderLayout.SOUTH);
                    pack();

-----------------------------------------------------------------------------------------

[Java] package musicdownloader; import javax.swing.*; import java.awt.*; - Pastebin.com This is my class that extends JPanel and an object of this is created in the code above.
I don't really see any code in this class that would be doing this, because the problem still happens even when I comment out all of the methods in this class except the constructor.

------------------------------------------------------------------------

I made the jpanel red so you can see whats happening
Download: Zippyshare.com - MusicDownloader.jar
If you download it, click the "download music" button and then resize the window to see the second jpanel. Also if you choose a file the path is only displayed on the bottom jpanel.

Pictures: ImageShack Album - 4 images

Thank you