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

       以一个输入框为例:

      









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

最终的效果如下:

JAVASwing GridBagLayout 布局

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

具体GridBagConstraints 可参见GridBagConstraints


相关文章:

  • 2021-05-31
  • 2021-09-20
  • 2022-12-23
  • 2021-06-05
  • 2021-10-26
  • 2022-12-23
  • 2021-11-19
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-04-22
  • 2021-04-17
  • 2022-12-23
  • 2022-12-23
  • 2021-12-10
  • 2021-12-24
相关资源
相似解决方案