Class AvatarGroup

All Implemented Interfaces:
Animation, Editable, StyleListener, Iterable<Component>

public class AvatarGroup extends Container

A row of overlapping avatars -- the people in a chat, the members of a team -- showing at most a few and a "+N" for the rest.

AvatarGroup group = new AvatarGroup(4);
for (String name : new String[] {"Ada Lovelace", "Grace Hopper", "Alan Turing"}) {
    group.addAvatar(new Avatar(name, null));
}

Each avatar gets a ring in the background colour so the overlap reads clearly. The UIID is AvatarGroup.

  • Constructor Details

    • AvatarGroup

      public AvatarGroup()
      A group showing at most four avatars.
    • AvatarGroup

      public AvatarGroup(int maxVisible)

      A group.

      Parameters
      • maxVisible: how many avatars to show before "+N"
  • Method Details

    • addAvatar

      public void addAvatar(Avatar a)

      Adds an avatar.

      Parameters
      • a: the avatar
    • clearAvatars

      public void clearAvatars()
      Removes every avatar.
    • getAvatarCount

      public int getAvatarCount()

      The number of avatars, shown or not.

      Returns

      the count

    • setMaxVisible

      public void setMaxVisible(int maxVisible)

      Sets how many avatars are shown before "+N".

      Parameters
      • maxVisible: at least one
    • setOverlap

      public void setOverlap(float fraction)

      Sets how much each avatar covers the one before it.

      Parameters
      • fraction: of the avatar width, 0 to 0.9