I have three JPanels written in JFrame. Currently, they are all configured to use the default FlowLayout stream. I would like them to be one above the other in one column.
However, I find that they float next to each other on the same line, while the components are inside them.
Is the natural width of a FlowLayout JPanel the sum of its contents? If so, is it possible to make the width of the region be the width of the JFrame?
Interestingly, I find that if the "top" and "bottom" panels have content that spans the entire width of the JFrame, and the "middle" panel remains empty, then the "middle" panel creates a space between them, just like the old "
html
Thanks,
Ben
java swing flowlayout
Ben
source share