Search code examples
javaswinggrid-layoutgaps-in-visuals

Java Swing Gridlayout VERTICAL constraint


Is it possible to add components in a Gridlayout verticaly ? I mean the next one above the previous one ?

Thank you


Solution

  • No, there is no layout that allows you to stack vertically from the bottom up, at least that I'm aware of. If you want vertical stacking you can either use a GridLayout with a single column or a BoxLayout with a vertical axis. By nesting panels and combining layouts you should easily get what you need, e.g. panels with a vertical layout all laid out in a horizontal container.