Open In App

Java AWT | BoxLayout Class

The BoxLayout class is used to arrange the components either vertically (along Y-axis) or horizontally (along X-axis). In BoxLayout class, the components are put either in a single row or a single column. The components will not wrap so, for example, a horizontal arrangement of components will stay horizontally arranged when the frame is resized.

Constructor of the class:



Commonly Used Methods:

Below programs illustrate the BoxLayout class:



Note: The above programs might not run in an online IDE. Please use an offline compiler.

Reference: https://docs.oracle.com/javase/7/docs/api/javax/swing/BoxLayout.html


Article Tags :