Class FlatLineBorder

  • All Implemented Interfaces:
    java.io.Serializable, javax.swing.border.Border, javax.swing.plaf.UIResource
    Direct Known Subclasses:
    FlatListCellBorder, FlatPopupMenuBorder, FlatTableCellBorder

    public class FlatLineBorder
    extends FlatEmptyBorder
    Line border for various components.

    Paints a scaled (usually 1px thick) line around the component. The line thickness is not added to the border insets. The insets should be at least have line thickness (usually 1,1,1,1).

    For JPanel and JLabel, this border can be used paint rounded background (if line color is null) or paint rounded line border with rounded background.

    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int arc  
      private java.awt.Color lineColor  
      private float lineThickness  
      • Fields inherited from class javax.swing.border.EmptyBorder

        bottom, left, right, top
    • Constructor Summary

      Constructors 
      Constructor Description
      FlatLineBorder​(java.awt.Insets insets, int arc)  
      FlatLineBorder​(java.awt.Insets insets, java.awt.Color lineColor)  
      FlatLineBorder​(java.awt.Insets insets, java.awt.Color lineColor, float lineThickness, int arc)  
    • Field Detail

      • lineColor

        private final java.awt.Color lineColor
      • lineThickness

        private final float lineThickness
      • arc

        private final int arc
        Since:
        2
    • Constructor Detail

      • FlatLineBorder

        public FlatLineBorder​(java.awt.Insets insets,
                              java.awt.Color lineColor)
      • FlatLineBorder

        public FlatLineBorder​(java.awt.Insets insets,
                              java.awt.Color lineColor,
                              float lineThickness,
                              int arc)
        Since:
        2
      • FlatLineBorder

        public FlatLineBorder​(java.awt.Insets insets,
                              int arc)
        Since:
        3.5
    • Method Detail

      • getLineColor

        public java.awt.Color getLineColor()
      • getLineThickness

        public float getLineThickness()
        Returns the (unscaled) line thickness used to paint the border. The line thickness does not affect the border insets.
      • getArc

        public int getArc()
        Returns the (unscaled) arc diameter of the border corners.
        Since:
        2
      • paintBorder

        public void paintBorder​(java.awt.Component c,
                                java.awt.Graphics g,
                                int x,
                                int y,
                                int width,
                                int height)
        Specified by:
        paintBorder in interface javax.swing.border.Border
        Overrides:
        paintBorder in class javax.swing.border.EmptyBorder