Class OverlayApi


  • public final class OverlayApi
    extends Object
    Behaviour pertaining to the heavyweight overlay.

    Overlay is only support if the video surface associated with the media player is a ComponentVideoSurface.

    • Method Detail

      • get

        public Window get()
        Get the overlay component.
        Returns:
        overlay component, may be null
      • set

        public void set​(Window overlay)
        Set a new overlay component.

        The existing overlay if there is one will be disabled.

        The new overlay will not automatically be enabled.

        The overlay should be a sub-class of Window or JWindow. If your overlay contains dynamically updated content such as a timer or animated graphics, then you should use JWindow so that your updates will be double-buffered and there will be no tearing or flickering when you paint the overlay. If you do this, you must take care to erase the overlay background before you paint it.

        When the overlay is no longer needed it is your responsibility to Window.dispose() it - if you do not do this you may leak resources. If you set multiple different overlays you must remember to dispose the old overlay.

        It is recommended to set the overlay once as early as possible in your application.

        Parameters:
        overlay - overlay component, may be null
      • enable

        public void enable​(boolean enable)
        Enable/disable the overlay component if there is one.
        Parameters:
        enable - whether to enable the overlay or disable it
      • enabled

        public boolean enabled()
        Check whether or not there is an overlay component currently enabled.
        Returns:
        true if there is an overlay enabled, otherwise false