Home Page
About Us


BoxLayout is a Java Swing layout manager that allows multiple components to be laid out either vertically or horizontally.


The GridBagLayout is a flexible Java Swing layout manager that aligns components vertically, horizontally or along their baseline without requiring that the components be of the same size



Boxlayout is far easier than gridbaglayout because you don t have to learn how to specify constraints

from question  

A java sidebar with GridBagLayout

Although madprogrammers comment to use a gridbaglayout is an easier solution but knowing about glue and struts can be helpful for customizing the layout of a boxlayout

from question  

How to Center JButtons in a centered JLabel in a BoxLayout?

While gridbaglayout gives you finer control and lets you diverge from a standard grid for example to do what you might do with rowspan or colspan in html;boxlayout is useful for a single row or single column

from question  

Which layout manager is best suited for rows and columns representation

Boxlayout is almost as easy;gridbaglayout is more powerful allowing more than one column components spanning more than one cell .

from question  

How do i get vertical scrolling to JPanel?

Back to Home
Data comes from Stack Exchange with CC-BY-SA-4.0