I'm having trouble with this program. In my textbook it says "Write an application that displays a frame containing two panels. Each panel should contain two images (use four unique images - your choice). Fix the size of the first panel so that both of its images remain side by side. Allow the other panel to change size as needed. Experiment with the size of the window to see the images change orientation. Make sure you understand why the application behaves as it does". I successfully imported the images, but I can't find out anywhere how to allow the second panel to change size with the window. I'm sure I'm just missing something obvious, but I would really appreciate some help. I'm also not really sure how to put code in here the right way so I'm sorry if it looks weird.
Does your textbook describe layout managers? I notice that you haven't used any specific layout managers, so by default you're using (I think, but maybe I'm wrong) BorderLayouts for each of your panels. However it seems to me that choosing some other layout manager would make it much easier to control things in the way you're asked to.
Joined: May 09, 2014
I have no idea what layout managers are let alone how to use them. I'm a bit of a noob to java.
I'm not really sure what the assignment is about because all your components are a fixed size so they will never grow. There will however change location within the frame as the frame is resized.
By default a JPanel uses a FlowLayout so you can read the tutorial to understand why the components changes location.
Regarding the other part of the question, I don't think you need the third panel. By default the content pane of a JFrame uses a BorderLayout. So try adding p1 to the NORTH and p2 to the CENTER to see if that makes a difference.