I have a JFrame with a JPanel on it.
I want to add another JPanel which is a preconfigured component onto the Jpanel inside my JFrame.
If I do this:
subPanel.setLayout(new BorderLayout());
subPanel.add(preconfiguredPanel,BorderLayout.CENTER);
my Panel will show.
If I do this:
subPanel.add(preconfiguredPanel);
my JPanel will not show. The documentation says when using add(Component) it will use the default Layout FlowLayout. Ok fine, but why won’t my component display inside that JPanel when using the default FlowLayout???
Probably because your panel doesn’t have a preferred size.
When you add a panel to a BorderLayout the default is to place it in the center, so the panel will automatically be resized to the size of the frame.
When you add the panel to a FlowLayout, the flow layout repsects the size of the panel.
If you need more help then post your SSCCE.