问题
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