5.0

5.0 | 4 ratings Rate this file 121 downloads (last 30 days) File Size: 61.7 KB File ID: #22968

GridBagLayout

by Jason

 

13 Feb 2009 (Updated 09 Oct 2009)

Code covered by BSD License  

A MATLAB class which controls layout and resize of a figure/uipanel/uicontainer.

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

Download Now | Watch this File

File Information
Description

layout.GridBagLayout is a MATLAB class which controls 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').

Acknowledgements
This submission has inspired the following:
UISIGNALBUILDER
MATLAB release MATLAB 7.7 (R2008b)
Zip File Content  
HTML Files Using the layout.GridBagLayout object.
Other Files
+layout/AbstractLayout.m,
+layout/GridBagConstraints.m,
+layout/GridBagLayout.m,
eGridBagLayout.m,
html/eGridBagLayout.png,
html/eGridBagLayout_01.png,
html/eGridBagLayout_02.png,
html/eGridBagLayout_03.png,
html/eGridBagLayout_04.png,
html/eGridBagLayout_05.png,
html/eGridBagLayout_06.png,
html/eGridBagLayout_07.png,
html/eGridBagLayout_08.png,
html/eGridBagLayout_09.png,
html/eGridBagLayout_10.png,
html/eGridBagLayout_11.png,
html/eGridBagLayout_12.png,
html/eGridBagLayout_13.png,
html/eGridBagLayout_14.png,
license.txt
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (4)
09 Mar 2009 Yair Altman

Magnificent piece of work!

16 Apr 2009 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 :-)

28 Apr 2009 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!

27 Aug 2009 Ashish Sadanandan  
Please login to add a comment or rating.
Updates
13 Feb 2009

Removed log files that were not relevant or useful.

24 Mar 2009

Update layout method to better handle Axes using the 'OuterPosition' property so that Insets are not always necessary. This will use MATLAB's built-in axes spacing management.

Recapture HTML.

28 Apr 2009

Fix typos and Axes positioning.

29 Apr 2009

Make Axes positioning dependent on the ActivePositionProperty. Thanks for the catch Ryan.

09 Oct 2009

Fix a bug with the use of UIPanel. Take into account the BorderWidth property when calculating the number of pixels available for the layout.

Tag Activity for this File
Tag Applied By Date/Time
gui Jason 13 Feb 2009 14:13:00
layout Jason 13 Feb 2009 14:13:00
gridbag Jason 13 Feb 2009 14:13:00
gridbaglayout Jason 13 Feb 2009 14:13:00
graphical user interface Jason 13 Feb 2009 14:13:00
resize Jason 13 Feb 2009 14:13:00
grid bag Jason 13 Feb 2009 14:18:58
potw Shari Freedman 20 Apr 2009 12:39:26
position Ryan Ollos 02 Oct 2009 20:44:47
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com