FlowLayout in conjection with setBounds()

自闭症网瘾萝莉.ら 提交于 2020-01-07 01:21:08

问题


I have a JFrame. I use setBounds() for determine position and size, but when I use frame.setLayout( new FlowLayout() ) all components are cluttered.

What is the solution?


回答1:


1) setBounds() is bad practice with null LayoutManager(setLayout(null)).

2) When you use FlowLayout, it calculates positions and sizes of components.

So, you can't mixing 2 approaches. Examine how to use LayoutManager.



来源:https://stackoverflow.com/questions/25258318/flowlayout-in-conjection-with-setbounds

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