controlsColumn.addButton("Set Layout Data of All Items to 100%/count Width", new ActionListener() {
public void actionPerformed(ActionEvent e) {
int componentCount = testRow.getComponentCount();
for (int i = 0; i < componentCount; ++i) {
RowLayoutData rowLayoutData = new RowLayoutData();
rowLayoutData.setWidth(new Extent(100 / componentCount, Extent.PERCENT));
rowLayoutData.setBackground(StyleUtil.randomBrightColor());
testRow.getComponent(i).setLayoutData(rowLayoutData);
}
}
});
controlsColumn.addButton("Set Layout Data (of random item)", new ActionListener() {
public void actionPerformed(ActionEvent e) {
int componentCount = testRow.getComponentCount();
if (componentCount == 0) {
return;
}
Component component = testRow.getComponent((int) (Math.random() * componentCount));
RowLayoutData rowLayoutData = new RowLayoutData();
rowLayoutData.setAlignment(StyleUtil.randomAlignmentHV());
rowLayoutData.setBackground(StyleUtil.randomBrightColor());
rowLayoutData.setInsets(new Insets((int) (Math.random() * 30)));
switch((int) (Math.random() * 7)) {
case 0:
rowLayoutData.setBackgroundImage(Styles.BG_SHADOW_DARK_BLUE);
break;
case 1:
rowLayoutData.setBackgroundImage(Styles.BG_SHADOW_LIGHT_BLUE);
break;
default:
rowLayoutData.setBackgroundImage(null);
}
component.setLayoutData(rowLayoutData);
}
});