java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JLabel
org.pushingpixels.radiance.theming.extras.internal.contrib.blogofbug.swing.components.ReflectedImageLabel
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, SwingConstants, RichComponent

public class ReflectedImageLabel extends JLabel implements RichComponent
A RichComponent which takes the supplied image, adds on 50% to the height of the image and draws a graduated alpha-blended reflection below the top aligned original image. The text (set by setRichText()) is drawn dynamically over the reflection, below the original image.
See Also:
  • Field Details

    • text

      private String text
      The richtext associated with this component
    • bufferedImage

      private BufferedImage bufferedImage
      The image with reflection
    • reference

      private static final Font reference
      A font used for reference purposes when evaluating the size of the rendered component
    • alphaComposite

      private AlphaComposite alphaComposite
      The desired alpha composite
  • Constructor Details

    • ReflectedImageLabel

      @Deprecated public ReflectedImageLabel(Image image, int width, int height)
      Deprecated.
      This function will be removed, use setNeutralWidth() on JCarousel instead.
      Creates a new instance from the supplied image object
      Parameters:
      image - The Image object
      width - The prefered width of the image when rendered by a rich container
      height - The prefered heightof the image when rendered by a rich container
    • ReflectedImageLabel

      @Deprecated public ReflectedImageLabel(Image image, String text, int width, int height)
      Deprecated.
      This function will be removed, use setNeutralWidth() on JCarousel instead.
      Creates a new instance of a reflected label for the supplied image, also setting the text to be associated with the image.
      Parameters:
      image - The image
      text - The text label
      width - The prefered width of the image when rendered by a rich container
      height - The prefered height of the image when rendered by a rich container
    • ReflectedImageLabel

      public ReflectedImageLabel(Image image, String text)
      Creates a new instance of a reflected label using the supplied image and text
      Parameters:
      image - The image to be used
      text - The text to be displayed
    • ReflectedImageLabel

      public ReflectedImageLabel(String imageURL)
      See constructor for image label, this version of the constructor takes an image URL instead of the image object (the URL can be in string format).
      Parameters:
      imageURL - A URL (in string form) of the image.
    • ReflectedImageLabel

      @Deprecated public ReflectedImageLabel(String imageURL, int width, int height)
      Deprecated.
      This function will be removed, use setNeutralWidth() on JCarousel instead.
      Creates a new instance, setting the width and the height that may be used by the RichContainer
      Parameters:
      imageURL - The URL of the image (String form)
      width - The prefered width of the image when rendered by a rich container
      height - The prefered height of the image when rendered by a rich container
    • ReflectedImageLabel

      @Deprecated public ReflectedImageLabel(String imageURL, String text, int width, int height)
      Deprecated.
      This function will be removed, use setNeutralWidth() on JCarousel instead.
      Creates a new instance, using the image specified in the URL string, the prefered dimensions and sets the Rich text as well
      Parameters:
      imageURL - The URL of the image in text form
      text - The RichText to be displayed
      width - The prefered width of the image when rendered by a rich container
      height - The prefered height of the image when rendered by a rich container
  • Method Details

    • setLabel

      @Deprecated public void setLabel(String text)
      Deprecated.
      Use setRichText() instead
      Depricated.
      Parameters:
      text - The rich text
    • setupImage

      protected void setupImage(Image image)
      Adds a reflection to the supplied image
      Parameters:
      image - The image object to use to pre-render the reflection
    • setAlpha

      public void setAlpha(float alphaLevel)
      Sets the transparency of the component
      Specified by:
      setAlpha in interface RichComponent
      Parameters:
      alphaLevel - The alpha level of the object
      See Also:
    • setImage

      @Deprecated public void setImage(Image image)
      Deprecated.
      Please use setRichImage() instead from the RichComponent interface
      Deprecated
      Parameters:
      image - An image object to use (reflection will be added)
      See Also:
    • getPreferredSize

      public Dimension getPreferredSize()
      Overrides the default getPreferedSize() which has been controlled by the created image and adds 50% onto the height to allow for the reflection.
      Overrides:
      getPreferredSize in class JComponent
      Returns:
      The prefered dimensions of the component
    • paintComponent

      public void paintComponent(Graphics graphics)
      Paints the component
      Overrides:
      paintComponent in class JComponent
      Parameters:
      graphics - The graphics context
    • setRichImage

      public void setRichImage(URL image)
      Assigns an image to the component, the width and height taken from the supplied image
      Specified by:
      setRichImage in interface RichComponent
      Parameters:
      image - The URL of the image
    • setRichImage

      public void setRichImage(File image)
      See interface definition
      Specified by:
      setRichImage in interface RichComponent
      Parameters:
      image - See interface definition
      See Also:
    • setRichImage

      public void setRichImage(Image image)
      See interface definition
      Specified by:
      setRichImage in interface RichComponent
      Parameters:
      image - See interface definition
      See Also:
    • prePaintImage

      public void prePaintImage()
      See interface definition
      Specified by:
      prePaintImage in interface RichComponent
      See Also:
    • setRichText

      public void setRichText(String text)
      See interface definition
      Specified by:
      setRichText in interface RichComponent
      Parameters:
      text - See interface definition
      See Also:
    • getRichText

      public String getRichText()
      See interface definition
      Specified by:
      getRichText in interface RichComponent
      Returns:
      See interface definition
      See Also: