Class DropShadowBorder

  • All Implemented Interfaces:
    java.io.Serializable, javax.swing.border.Border

    public class DropShadowBorder
    extends javax.swing.border.AbstractBorder
    A drop shadow border. Draws a 1 pixel line completely around the component, and a drop shadow effect on the right and bottom sides. Use this like any other border in javax.swing.borders.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      DropShadowBorder()
      Drop shadow with default width of 3 pixels and black color.
      DropShadowBorder​(int width)
      Drop shadow, default shadow color is black.
      DropShadowBorder​(int width, java.awt.Color color)
      Drop shadow, width and color are adjustable.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.awt.Insets getBorderInsets​(java.awt.Component c)
      This implementation returns a new Insets instance where the top and left are 1, the bottom and right fields are the border width + 1.
      java.awt.Insets getBorderInsets​(java.awt.Component c, java.awt.Insets insets)
      Reinitializes the insets parameter with this DropShadowBorder's current Insets.
      boolean isBorderOpaque()
      This implementation always returns true.
      void paintBorder​(java.awt.Component c, java.awt.Graphics g, int x, int y, int width, int height)
      Paints the drop shadow border around the given component.
      • Methods inherited from class javax.swing.border.AbstractBorder

        getBaseline, getBaselineResizeBehavior, getInteriorRectangle, getInteriorRectangle
      • Methods inherited from class java.lang.Object

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

      • DropShadowBorder

        public DropShadowBorder()
        Drop shadow with default width of 3 pixels and black color.
      • DropShadowBorder

        public DropShadowBorder​(int width)
        Drop shadow, default shadow color is black.
        Parameters:
        width - the width of the shadow.
      • DropShadowBorder

        public DropShadowBorder​(int width,
                                java.awt.Color color)
        Drop shadow, width and color are adjustable.
        Parameters:
        width - the width of the shadow.
        color - the color of the shadow.
    • Method Detail

      • getBorderInsets

        public java.awt.Insets getBorderInsets​(java.awt.Component c)
        This implementation returns a new Insets instance where the top and left are 1, the bottom and right fields are the border width + 1.
        Specified by:
        getBorderInsets in interface javax.swing.border.Border
        Overrides:
        getBorderInsets in class javax.swing.border.AbstractBorder
        Parameters:
        c - the component for which this border insets value applies
        Returns:
        a new Insets object initialized as stated above.
      • getBorderInsets

        public java.awt.Insets getBorderInsets​(java.awt.Component c,
                                               java.awt.Insets insets)
        Reinitializes the insets parameter with this DropShadowBorder's current Insets.
        Overrides:
        getBorderInsets in class javax.swing.border.AbstractBorder
        Parameters:
        c - the component for which this border insets value applies
        insets - the object to be reinitialized
        Returns:
        the given insets object
      • isBorderOpaque

        public boolean isBorderOpaque()
        This implementation always returns true.
        Specified by:
        isBorderOpaque in interface javax.swing.border.Border
        Overrides:
        isBorderOpaque in class javax.swing.border.AbstractBorder
        Returns:
        true
      • paintBorder

        public void paintBorder​(java.awt.Component c,
                                java.awt.Graphics g,
                                int x,
                                int y,
                                int width,
                                int height)
        Paints the drop shadow border around the given component.
        Specified by:
        paintBorder in interface javax.swing.border.Border
        Overrides:
        paintBorder in class javax.swing.border.AbstractBorder
        Parameters:
        c - - the component for which this border is being painted
        g - - the paint graphics
        x - - the x position of the painted border
        y - - the y position of the painted border
        width - - the width of the painted border
        height - - the height of the painted border