Invisible components still take up space JPanel

前端 未结 6 1364
渐次进展
渐次进展 2021-01-18 05:22

I have a series of components underneath each other in a JPanel set as a GridLayout. I need to temporarily hide the components but setVisible(false) doesn\'t cu

6条回答
  •  情书的邮戳
    2021-01-18 06:01

    I really don't like the GridLayout. Instead of writing your own layout manager, I would suggest you take a look at the TableLayout. I use it all the time.

    The initial learning curve is a bit steeper than the GridLayout, but it is easy to get it to behave the way you want.

    http://java.sun.com/products/jfc/tsc/articles/tablelayout/

提交回复
热议问题