Class ConfigurableLineBorder

  • All Implemented Interfaces:
    Border

    public class ConfigurableLineBorder
    extends Object
    implements Border
    Border class that allows each of the four sides of the border to be enabled or disabled independently.
    • Constructor Detail

      • ConfigurableLineBorder

        public ConfigurableLineBorder​(boolean top,
                                      boolean left,
                                      boolean bottom,
                                      boolean right,
                                      int thickness)
        Parameters:
        top - Whether or not to draw the border on the top edge.
        left - Whether or not to draw the border on the left edge.
        bottom - Whether or not to draw the border on the bottom edge.
        right - Whether or not to draw the border on the right edge.
        thickness - The width (in pixels) of each side of the border.
    • Method Detail

      • paintBorder

        public void paintBorder​(Component component,
                                Graphics graphics,
                                int x,
                                int y,
                                int width,
                                int height)
        Renders borders for the specified component based on the configuration of this border object.
        Specified by:
        paintBorder in interface Border
        Parameters:
        component - The component for which the border is painted.
        graphics - A Graphics object to use for painting.
        x - The X-coordinate of the top left point of the border rectangle.
        y - The Y-coordinate of the top left point of the border rectangle.
        width - The width of the border rectangle.
        height - The height of the border rectangle.
      • getBorderInsets

        public Insets getBorderInsets​(Component component)
        Specified by:
        getBorderInsets in interface Border
        Parameters:
        component - The component for which the border is painted.
        Returns:
        Insets for the current border configuration.
      • isBorderOpaque

        public boolean isBorderOpaque()
        Specified by:
        isBorderOpaque in interface Border
        Returns:
        false