【问题标题】:How to get GWT widget type如何获取 GWT 小部件类型
【发布时间】:2012-10-23 12:53:57
【问题描述】:

有什么方法可以获取 GWT 小部件的类型吗?

for(Widget w : widgetList)  
{  
 //if w is textbox type, read value and do something

}

【问题讨论】:

  • w instanceof TextBox?或者可能是w.getClass() == TextBox.class
  • 当然。 GWT Widget 的类型只是一个类。并且一个类也是对象 - 类Class 的实例。但是方法因此,更正确地使用方法equals:w.getClass().equals(TextBox.class)Read more

标签: gwt


【解决方案1】:
for(Widget w : widgetList)
{
  if(w instanceof textbox)
        // read value and do something
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-08
    相关资源
    最近更新 更多