How get all widgets of certain type?

gwt

Solution

Here you go :

We can use `iterator.`

Iterator<Widget> arrayOfWidgets = abslPanel.iterator();
while (arrayOfWidgets.hasNext()){
  Widget ch = arrayOfWidgets .next();
  if (ch instanceof Button) {
  //Do something (in your case make an arraylist of your objects)
  }
}

Problem

I have an AbsolutePanel and different widgets (Buttons, Images, Labels, e.t.c.) on it. Is it possible to get collection or array or whatever of all widgets of certain type, for example - Image?

Original source