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').
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 :-)