JAVASwing GridBagLayout 布局

       用GridBagLayout可实现复杂可控的布局。

       以一个输入框为例:

      










 这里面用到了GridBagConstraints 来定义组件的位置排列信息。

最终的效果如下:

后面输入框的长度可以修改值200 来改变。

具体GridBagConstraints 可参见GridBagConstraints


原文地址:https://www.cnblogs.com/yjl49/p/2371944.html