Class GradientBackground

  • All Implemented Interfaces:
    IBackground

    public class GradientBackground
    extends java.lang.Object
    implements IBackground
    Paint a top to bottom gradient.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.awt.Color fEndColor  
      private java.awt.Color fStartColor  
    • Constructor Summary

      Constructors 
      Constructor Description
      GradientBackground​(java.awt.Color startColor, java.awt.Color endColor)
      Create a gradient background
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void paintBackground​(java.awt.Graphics g, boolean isMouseOver, int cornerRadius)
      Paint the background
      void setAlpha​(float alpha)
      Set the alpha of this component.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • fStartColor

        private java.awt.Color fStartColor
      • fEndColor

        private java.awt.Color fEndColor
    • Constructor Detail

      • GradientBackground

        public GradientBackground​(java.awt.Color startColor,
                                  java.awt.Color endColor)
        Create a gradient background
        Parameters:
        startColor - color to use from top
        endColor - color to use at the bottom
    • Method Detail

      • paintBackground

        public void paintBackground​(java.awt.Graphics g,
                                    boolean isMouseOver,
                                    int cornerRadius)
        Description copied from interface: IBackground
        Paint the background
        Specified by:
        paintBackground in interface IBackground
        Parameters:
        g - graphics to paint on
        isMouseOver - true if the mouse if over the notification
        cornerRadius - corner radius of the window
      • setAlpha

        public void setAlpha​(float alpha)
        Description copied from interface: IBackground
        Set the alpha of this component. Usual you don't call this method. Instead use NotificationBuilder.withAlpha(float)
        Note this only works if the GraphicsConfiguration supports per-pixel translucency.
        Specified by:
        setAlpha in interface IBackground
        Parameters:
        alpha - value between 0.0f (completely transparent) and 1.0f (opaque)