Download presentation
Presentation is loading. Please wait.
1
GUI Layouts By: Leonard & Saif
2
Purpose The purpose of a GUI layout is to organize objects & elements of a GUI in a specific order to look aesthetically pleasing and fitting It is essential to select a proper GUI layout for the GUI’s specific purpose
3
GUI Layout Managers Java has a variety of layout managers that can be used as parameters in the setLayout() method. Examples include: BoxLayout FlowLayout GridLayout GridBagLayout
4
Commands associated with GUI layouts
.setLayout() contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.PAGE_AXIS)); contentPane is a variable for a JPanel which is a generic lightweight container for components of a GUI This command is used to set the specific layout style to be attached to a JPanel
5
Commands associated with GUI layouts
Setting Borderlayout
6
Examples of how it can be implemented
7
BorderLayout A BorderLayout places components in up to five areas: top, bottom, left, right, and center All extra space is placed in the center area.
8
BoxLayout The BoxLayout class puts components in a single row or column. It respects the components' requested maximum sizes and also lets you align components.
9
FlowLayout It simply lays out components in a single row
It starts a new row if its container is not sufficiently wide..
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.