【问题标题】:Google Web Toolkit - Flextable CSS谷歌网络工具包 - 弹性表格 CSS
【发布时间】:2014-05-09 08:19:44
【问题描述】:

[a] [b] [c]

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

我只想为 a 列设置橙色背景色。如何设置?请帮我。谢谢。

【问题讨论】:

    标签: css gwt flextable


    【解决方案1】:

    尝试使用更易于管理的 CSS 样式。 如果你以后想改变它,那么你不需要触摸 JAVA 代码。

    通过这种方式,您可以从主题中受益。

    JAVA:

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

    CSS:

    .yellowBackground {
        background-color: yellow;
    }
    

    【讨论】:

      【解决方案2】:

      试试这个:

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

      【讨论】:

      • 无论如何,如果您与我们分享更多信息,我们可以为您提供更完整的答案,例如使用 UiBinder、CssResources 或 GQuery。顺便说一句,编码愉快。
      猜你喜欢
      • 1970-01-01
      • 2011-05-13
      • 1970-01-01
      • 2011-03-11
      • 2011-07-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多