Presentation is loading. Please wait.

Presentation is loading. Please wait.

GUI Layouts By: Leonard & Saif.

Similar presentations


Presentation on theme: "GUI Layouts By: Leonard & Saif."— Presentation transcript:

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..


Download ppt "GUI Layouts By: Leonard & Saif."

Similar presentations


Ads by Google