DesignGridLayout 1.1: Now With Multiple Row-Span Support
Join the DZone community and get the full member experience.Join For Free
Version 1.1 brings the following features in comparison to 1.0:
- support for components spanning multiple rows through an ultra simple API
- optimized the size of the example jar (removed all screenshots that are used during automatic tests)
- completely refactored the examples application
- added an option to disable "smart vertical resize" feature
Support for components spanning multiple rows is the main improvement in this version, you can see an usage example following:
JList list = new JList();which gives the following result (with default Look & Feel):
// Further list initialization here...
DesignGridLayout layout = new DesignGridLayout(panel);
layout.row().grid(new JLabel("lbl11")).add(new JTextField("field11")).grid(new JLabel("lbl12")).add(list);
layout.row().grid(new JLabel("lbl21")).add(new JTextField("field21")).grid().spanRow();
In addition, the following bugs have been fixed:
- fixed several problems with baseline alignment (only on Java 5)
- fixed a problem with smart vertical resize of JList
- fixed an exception with multi-grid feature
- fixed an exception when creating a row but adding no component to it
- fixed a bad look with grids having just a label but no component
What is DesignGridLayout?
DesignGridLayout is a revolutionary and innovative Swing LayoutManager inspired by the use of canonical grids for user interface design.
DesignGridLayout's primary innovation is a well behaved simple layout algorithm exposed as a convenient API. Just add rows from top to bottom and components from left to right.
DesignGridLayout is also a smart Swing LayoutManager:
- it manages all margins, gaps, alignments (baseline and vertical) automagically for you, while respecting UI guidelines for the current platform (as defined by the Look and Feel)
- it makes sure your UI is always visually pleasing (that's the power of canonical grids)
- it knows how to count: you never need to specify upfront how many columns or rows you have in your UI, DesignGridLayout will automatically count that for you! This way, you generally don't need to mock up your UI on paper first and try to draw virtual grid lines like most grid-oriented LayoutManagers impose
- it does not require you to specify which rows should be able to vertically grow during user resize and which rows should have fixed height: DesignGridLayout automatically detect which rows should vary in height!
- DesignGridLayout will also make sure that the height of components such as a JList is always appropriate for the content, i.e. allows to display all rows in their full height (not truncated like all other LayoutManagers)
- thanks to its fluent API, DesignGridLayout makes it a breeze to define your UI forms; it also makes the learning curve very short: you can be fully effective in less than one hour!
DesignGridLayout API is so intuitive that you can master it in just a couple of hours. After just one hour, you are able to build your forms and dialogs in no time:
- Write the layout code the way the layout should appear
- Run the code
- It just works!
With DesignGridLayout, there is no need for a long "code, try and repeat" process. No need to fine-tune the layout code with hard-coded dimensions either, canonical grids just ensure that components are sized correctly!
What's coming next for DesignGridLayout?
Opinions expressed by DZone contributors are their own.