7 Layouts

This chapter covers each Layout in detail. For an explanation of how Layouts fit into the overall architecture of Metawidget, see Chapter 2, Architecture.

7.1 Desktop Layouts

7.1.1 Swing Layouts

7.1.1.1 BoxLayout

Layout to simply output components one after another, with no labels and no structure, using javax.swing.BoxLayout. This is like FlowLayout (below), except it fills width. It can be useful for JTable CellEditors.

7.1.1.2 FlowLayout

Layout to simply output components one after another, with no labels and no structure, using javax.awt.FlowLayout.

7.1.1.3 GridBagLayout

Layout to arrange widgets using javax.awt.GridBagLayout. Widgets are arranged in a table, with one column for labels and another for the widget. This Layout recognizes the following parameters, configured using GridBagLayoutConfig:

Property Description
numberOfColumns number of columns. Each label/component pair is considered one column
labelAlignment Such as SwingConstants.LEFT or SwingConstants.RIGHT
sectionStyle Either GridBagLayoutConfig.SECTION_AS_HEADING or GridBagLayoutConfig.SECTION_AS_TAB
labelSuffix Text to display after label text. Defaults to a colon (:)
requiredAlignment Such as SwingConstants.LEFT or SwingConstants.RIGHT
requiredText Text to display for required fields. Defaults to a star (*)

7.1.1.4 GroupLayout

Layout to arrange widgets using javax.swing.GroupLayout. Widgets are arranged in a table, with one column for labels and another for the widget.

7.1.1.5 MigLayout

Layout to arrange widgets using net.miginfocom.swing.MigLayout. Widgets are arranged in a table, with one column for labels and another for the widget. This Layout recognizes the following parameters, configured using MigLayoutConfig:

Property Description
numberOfColumns number of columns. Each label/component pair is considered one column
sectionStyle Either MigLayoutConfig.SECTION_AS_HEADING or MigLayoutConfig.SECTION_AS_TAB