Interface RolloverIcon.IconRolloverSupport

  • Enclosing class:
    RolloverIcon

    public static interface RolloverIcon.IconRolloverSupport
    An interface that should be implemented on a component if you want to use an icon that supports rollover and fade (fade in or fade out) effect.
    • Method Detail

      • isIconRollover

        boolean isIconRollover​(int x,
                               int y,
                               int width,
                               int height)
        Checks if the mouse is over an icon. In the implementation, you can use a MouseMotionListener to detect the mouse position and see if it is over the icon.
        Parameters:
        x - x of the icon
        y - y of the icon
        width - icon width
        height - icon height
        Returns:
        true if the mouse is over the icon. False if not.
      • isIconFade

        boolean isIconFade()
        Checks if the icon should be faded. Because the fade is an animation, we will call getIconAlpha() immediately to find out the alpha value of the fade. In your implementation, you can use an Animator or any other animation frameworks to change the iconAlpha value and ask the icon to repaint itself again.
        Returns:
        true of the icon should be faded. If it returns true, getIconAlpha() will be called to find out the alpha value.
      • getIconAlpha

        float getIconAlpha()
        Gets the icon alpha value. We will paint the icon using the provided alpha value to create the fade effect.
        Returns:
        the icon alpha value.