GridBagLayout 适合需要精确控制行列比例、组件跨行跨列的表单区域,虽然约束参数多,但一旦配好就非常稳定。 局部细节用 BoxLayout 或者 FlowLayout 就够了。 BoxLayout 适合纵向或横向排列一组等宽按钮,FlowLayout 适合一排自动换行的小控件。