Class SafeBorder

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

    public class SafeBorder
    extends javax.swing.border.AbstractBorder
    implements javax.swing.plaf.UIResource
    Wrapper around a delegate with the same behaviour as the delegate except that it catches null insets (hack around Issue 1297-swingx which is core bug 6739738)
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private javax.swing.border.AbstractBorder delegate  
    • Constructor Summary

      Constructors 
      Constructor Description
      SafeBorder​(javax.swing.border.AbstractBorder delegate)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getBaseline​(java.awt.Component c, int width, int height)
      java.awt.Component.BaselineResizeBehavior getBaselineResizeBehavior​(java.awt.Component c)
      java.awt.Insets getBorderInsets​(java.awt.Component c)
      java.awt.Insets getBorderInsets​(java.awt.Component c, java.awt.Insets insets)
      java.awt.Rectangle getInteriorRectangle​(java.awt.Component c, int x, int y, int width, int height)
      boolean isBorderOpaque()
      void paintBorder​(java.awt.Component c, java.awt.Graphics g, int x, int y, int width, int height)
      private java.awt.Insets safeInsets​(java.awt.Insets insets)  
      • Methods inherited from class javax.swing.border.AbstractBorder

        getInteriorRectangle
      • Methods inherited from class java.lang.Object

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

      • delegate

        private javax.swing.border.AbstractBorder delegate
    • Constructor Detail

      • SafeBorder

        public SafeBorder​(javax.swing.border.AbstractBorder delegate)
    • Method Detail

      • getBaseline

        public int getBaseline​(java.awt.Component c,
                               int width,
                               int height)
        Overrides:
        getBaseline in class javax.swing.border.AbstractBorder
      • getBaselineResizeBehavior

        public java.awt.Component.BaselineResizeBehavior getBaselineResizeBehavior​(java.awt.Component c)
        Overrides:
        getBaselineResizeBehavior in class javax.swing.border.AbstractBorder
      • getBorderInsets

        public java.awt.Insets getBorderInsets​(java.awt.Component c,
                                               java.awt.Insets insets)
        Overrides:
        getBorderInsets in class javax.swing.border.AbstractBorder
      • safeInsets

        private java.awt.Insets safeInsets​(java.awt.Insets insets)
        Parameters:
        insets - the insets to query
        Returns:
        the insets supplied or an empty insets if the value is null
      • getBorderInsets

        public java.awt.Insets getBorderInsets​(java.awt.Component c)
        Specified by:
        getBorderInsets in interface javax.swing.border.Border
        Overrides:
        getBorderInsets in class javax.swing.border.AbstractBorder
      • getInteriorRectangle

        public java.awt.Rectangle getInteriorRectangle​(java.awt.Component c,
                                                       int x,
                                                       int y,
                                                       int width,
                                                       int height)
        Overrides:
        getInteriorRectangle in class javax.swing.border.AbstractBorder
      • isBorderOpaque

        public boolean isBorderOpaque()
        Specified by:
        isBorderOpaque in interface javax.swing.border.Border
        Overrides:
        isBorderOpaque in class javax.swing.border.AbstractBorder
      • 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.AbstractBorder