2014-05-09 27 views
0

[A] [B] [C]谷歌Web工具包 - Flextable CSS

flextable1.setWidget(0, 0, new Label("a")); 
flexTable1.setWidget(0, 1, new Label("b")); 
flexTable1.setWidget(0, 2, new Label("c")); 

我想设置的橙色背景颜色仅列。如何设置?请帮帮我。谢谢。

回答

0

试试这个:

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"); 
    } 
+0

非常感谢你,apanizo。 – user3007865

+0

无论如何,如果您与我们分享更多信息,我们可以为您提供更完整的答案,例如使用UiBinder,CssResources或GQuery。快乐的编码方式。 – apanizo

+0

不客气! – apanizo

1

尝试用CSS风格,是更易于管理。 如果你想在将来改变它,那么你不需要触摸JAVA代码。

以这种方式您可以受益于主题。

JAVA:

// set style for first row and first column 
flexTable.getFlexCellFormatter().setStyleName(0, 0,"yellowBackground"); 

CSS:

.yellowBackground { 
    background-color: yellow; 
} 
+0

谢谢你,Braj。 – user3007865

+0

根本不是。别客气。 – Braj