Class DrawnComponentManager

java.lang.Object
edu.cnu.mdi.component.DrawnComponentManager

public final class DrawnComponentManager extends Object
Shared animation manager for drawn buttons.

The manager owns one Swing Timer. Animated buttons register when they become displayable and unregister when removed from the Swing hierarchy. The timer stops when no animated buttons remain.

  • Field Details

    • DEFAULT_DELAY

      public static final int DEFAULT_DELAY
      Milliseconds between animation frames, roughly 30 frames per second.
      See Also:
  • Method Details

    • getInstance

      public static DrawnComponentManager getInstance()
      Returns the shared animation manager.
      Returns:
      the singleton manager
    • register

      public void register(AbstractButton button)
      Registers a button for animation repainting.
      Parameters:
      button - the button to repaint on animation frames
    • unregister

      public void unregister(AbstractButton button)
      Unregisters a button from animation repainting.
      Parameters:
      button - the button to unregister
    • getFrameCount

      public long getFrameCount()
      Returns the number of elapsed animation frames.
      Returns:
      the current frame count