[a] [b] [c]
flextable1.setWidget(0, 0, new Label("a"));
flexTable1.setWidget(0, 1, new Label("b"));
flexTable1.setWidget(0, 2, new Label("c"));
I want set the orange background color only for column a. How to set? Please help me. Thanks.
[a] [b] [c]
flextable1.setWidget(0, 0, new Label("a"));
flexTable1.setWidget(0, 1, new Label("b"));
flexTable1.setWidget(0, 2, new Label("c"));
I want set the orange background color only for column a. How to set? Please help me. Thanks.
Try with CSS style that is more manageable. If you want to change it in future then you don't need to touch the JAVA code.
In this way you can benefit of Themes.
JAVA:
// set style for first row and first column
flexTable.getFlexCellFormatter().setStyleName(0, 0,"yellowBackground");
CSS:
.yellowBackground {
background-color: yellow;
}
Try this:
public void onModuleLoad() {
FlexTable flexTable1 = new FlexTable();
Label a = new Label("a");
flexTable1.setWidget(0, 0, a);
flexTable1.setWidget(0, 1, new Label("b"));
flexTable1.setWidget(0, 2, new Label("c"));
//add your widget to your panel, I used RootPanel directly for this example.
RootPanel.get().add(flexTable1);
a.getElement().getStyle().setBackgroundColor("orange");
}