I'm trying to add somes components to a JPanel in flowLayout.
JPanel panelPrincipal = new JPanel();
principale.getContentPane().add(panelPrincipal, BorderLayout.CENTER);
panelPrincipal.setLayout(new BorderLayout(0, 0));
JPanel panelDynamique = new JPanel();
JScrollPane jScrollPane = new JScrollPane(panelDynamique);
panelPrincipal.add(jScrollPane, BorderLayout.CENTER);
if(this.getNbAppFor(champs.get(6)) > 0) {
JLabel lblMAJ = new JLabel(champs.get(6));
panelDynamique.add(lblMAJ);
panelDynamique.add(new JSeparator());
JPanel panelMAJ = new JPanel();
panelMAJ.setLayout(new GridLayout(this.getNbAppFor(champs.get(6))/2, 2));
panelDynamique.add(panelMAJ);
}
if(this.getNbAppFor(champs.get(7)) > 0) {
JLabel lblDispo = new JLabel(champs.get(7));
panelDynamique.add(new JSeparator());
JPanel panelDispo = new JPanel();
panelDispo.setLayout(new GridLayout(this.getNbAppFor(champs.get(7))/2, 2));
panelDynamique.add(panelDispo);
}
It's the core build, but it doesn't look how I expected.
I made an illustration of what I'm trying to do:
How can I add a component to a FlowLayout in a next "row" under the previous component? And how can I make my separators fill the width of my Container?

according to your drawing, but not used FlowLayout.
you may find useful oracle