@SuppressWarnings("deprecation")
 private void replaceSurfaceDataRecursively(Component c) {
   if (c instanceof Container) {
     for (Component child : ((Container) c).getComponents()) {
       replaceSurfaceDataRecursively(child);
     }
   }
   ComponentPeer cp = c.getPeer();
   if (cp instanceof WComponentPeer) {
     ((WComponentPeer) cp).replaceSurfaceDataLater();
   }
 }
Example #2
0
  /**
   * Returns the native container object of the specified component. This method is necessary
   * because the parent component might be a lightweight component.
   *
   * @param component The component to fetch the native container for.
   * @return The native container object for this component.
   */
  protected static Container getNativeContainer(Component component) {
    component = component.getParent();

    for (; ; ) {
      if (component == null) return (null);

      if (!(component instanceof Container)) {
        component = component.getParent();
        continue;
      }

      if (component.getPeer() instanceof LightweightPeer) {
        component = component.getParent();
        continue;
      }

      return ((Container) component);
    }
  }