Tuesday, February 26, 2008

Suppressing Label Generation in Metawidget

Many Metawidget layouts add a label beside each component, and it is sometimes handy to tweak this on a per-row basis.

Take, for example, the Swing Address Book example from the tutorial:

Say we decide the Address and Communications labels under Contact Details are unnecessary. To remove them, we simply specify a blank label:

@UiLabel( "" )
public Address getAddress() {


And Metawidget collapses the left hand column:

This can be particularly useful within JTabbedPanes, collapsing this...


...to this:
To hide the label without collapsing the left hand column, use a ResourceBundle to localize the label name to a blank space.

0 comments: