0

I am adding more than one panel to a Frame and they are not automatically spacing out. I have a layout manager for each panel. Do I need one for the Frame as well?

The frame is 600X240 and each panel is 200X200. I need the three panels to space out perfectly. How do I force the frame to add one then add the second one where the first ends etc.?

EDIT** I added this line of code to my frame's constructor:

setLayout(new GridLayout(1,3));

and it now works perfectly.

4

1 回答 1

0

我认为 LayoutManagers 是特定于 JPanel 的,但现在我意识到它们用于所有组件。我在 OP 中添加了一个编辑,表明我就是这样做的。谢谢!

于 2012-10-28T23:47:31.070 回答