Why aren't my components wrapping in Swing's FlowLayout?

独自空忆成欢 提交于 2019-12-02 07:20:23

That's because FlowLayout doesn't. I know, it sucks.

But, you could take a look at WrapLayout which is a solution to this problem

I know this is an old question, but I stumbled upon it while trying to solve the same problem. It is not entirely true that FlowLayout will not wrap its child components.

The issue is that the JPanel with your desired FlowLayout must be inside another container that will resize and allow the FlowLayout to also resize and therefore wrap. In my experience, the CENTER region of a BorderLayout is the only such container that will allow this to happen.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!