Building GUI using GroupLayout in Java

穿精又带淫゛_ 提交于 2019-11-30 21:28:39

Fixed some parantheses and added resizing hints for components:

layout.setHorizontalGroup(layout
    .createParallelGroup(GroupLayout.Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
        .addComponent(one, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        .addComponent(two, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        .addComponent(three, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
    .addGroup(layout.createSequentialGroup()
        .addComponent(four, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        .addComponent(five, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
    .addComponent(six, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));

layout.setVerticalGroup(layout.createSequentialGroup()
    .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
        .addComponent(one).addComponent(two).addComponent(three))
    .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
        .addComponent(four).addComponent(five))
    .addComponent(six));

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!