File Exchange

image thumbnail


version (75 KB) by Jason
A MATLAB class which controls layout and resize of a figure/uipanel/uicontainer.


Updated 02 May 2017

View Version History

View License

Editor's Note: This file was selected as MATLAB Central Pick of the Week

layout.GridBagLayout and layout.ScrollableGridBagLayout are MATLAB classes which control layout and resize of a figure/uipanel/uicontainer. This class helps the MATLAB GUI developer design complex Graphical User Interfaces without the need for calculations or complex code for performing initial layouts or writing resize functions.
To get this to work in 2007b/2008a you can simply replace the calls to ishghandle(h, 'figure') with strcmp(get(h, 'type'), 'figure').

Cite As

Jason (2021). GridBagLayout (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (8)

Ryan Nickles

Kristian Sørensen

Just fantastic! This is the cure for GUIDE!

Dirk Engel

Ryan Ollos

Author has done a great job of responding to suggestions and making improvements and minor bug fixes.

Ashish Sadanandan

Ryan Ollos

This code makes up for a major shortcoming of MATLAB, and has helped me write GUIs more quickly and more cleanly. Thank you for sharing this great piece of work!

Laurent Vaylet

WOW!! We finally get these nice Java layout features in MATLAB. Congratulations, it is a really useful, documented and illustrated piece of code. If a 6-star rating existed, you would surely get it :-)

Yair Altman

Magnificent piece of work!

MATLAB Release Compatibility
Created with R2015b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired: UISIGNALBUILDER, GridLayout, UISignalBuilder2

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!