/** * @param group must append its actors through standard {@link WidgetGroup#addActor(Actor)} * method. Must support {@link WidgetGroup#addActorAfter(Actor, Actor)} and {@link * WidgetGroup#addActorBefore(Actor, Actor)} methods. Note that {@link * com.badlogic.gdx.scenes.scene2d.ui.Table} does not meet these requirements. * @see VerticalGroup * @see HorizontalGroup * @see GridGroup */ public DragPane(final WidgetGroup group) { if (group == null) { throw new IllegalArgumentException("Group cannot be null."); } super.setActor(group); setTouchable(Touchable.enabled); }
/** * @param group will replace the internally managed group. All current children will be moved to * this group. */ @Override public void setActor(final WidgetGroup group) { if (group == null) { throw new IllegalArgumentException("Group cannot be null."); } final Group previousGroup = getActor(); super.setActor(group); attachListener(); // Attaches draggable to all previous group children. for (final Actor child : previousGroup.getChildren()) { group.addActor(child); // No need to attach draggable, child was already in pane. } }