Package com.ribs

Class RUBorders


  • public class RUBorders
    extends java.lang.Object
    A class to help manage and archive borders.

    Would be nice if border archival supported multiple elements and nested elements to easily express compound borders (would also need nice border inspector).

    Would also be nice to archive more border specific attributes, like EmptyBorder insets and LineBorder color and thickness (again, only useful with new border inspector UI).

    Might also be nice to do "Border was explicitly overridden by Ribs" trick with borders, like we do with foreground/background (with reset button). This might make it viable to offer border editing to all components.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  RUBorders.DashedBorder  
    • Constructor Summary

      Constructors 
      Constructor Description
      RUBorders()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static javax.swing.border.Border fromXML​(javax.swing.JComponent aComponent, RXElement anElement)
      Border XML unarchival.
      static javax.swing.border.Border getBorder​(javax.swing.border.Border aBorder)
      Returns the given border, or if border is TitledBorder, the titled inner border.
      static java.lang.String getTitle​(javax.swing.border.Border aBorder)
      Returns the title of a given border (if it's a titled border).
      static java.awt.Font getTitleFont​(javax.swing.border.Border aBorder)
      Returns the title font of the given border (if it's a TitledBorder).
      static boolean isEmpty​(javax.swing.border.Border aBorder)
      Returns whether a border is effectively not there (either null or an EmptyBorder with no margin).
      static javax.swing.border.Border setTitle​(javax.swing.border.Border aBorder, java.lang.String aTitle)
      Sets the title of a given border (if it's a titled border).
      static void setTitleFont​(javax.swing.border.Border aBorder, java.awt.Font aFont)
      Sets the title font of the given border (if it's a TitledBorder).
      static RXElement toXML​(javax.swing.border.Border aBorder)
      Border XML archival.
      • Methods inherited from class java.lang.Object

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

      • RUBorders

        public RUBorders()
    • Method Detail

      • getTitle

        public static java.lang.String getTitle​(javax.swing.border.Border aBorder)
        Returns the title of a given border (if it's a titled border).
      • setTitle

        public static javax.swing.border.Border setTitle​(javax.swing.border.Border aBorder,
                                                         java.lang.String aTitle)
        Sets the title of a given border (if it's a titled border).
      • getTitleFont

        public static java.awt.Font getTitleFont​(javax.swing.border.Border aBorder)
        Returns the title font of the given border (if it's a TitledBorder).
      • setTitleFont

        public static void setTitleFont​(javax.swing.border.Border aBorder,
                                        java.awt.Font aFont)
        Sets the title font of the given border (if it's a TitledBorder).
      • getBorder

        public static javax.swing.border.Border getBorder​(javax.swing.border.Border aBorder)
        Returns the given border, or if border is TitledBorder, the titled inner border.
      • isEmpty

        public static boolean isEmpty​(javax.swing.border.Border aBorder)
        Returns whether a border is effectively not there (either null or an EmptyBorder with no margin).
      • toXML

        public static RXElement toXML​(javax.swing.border.Border aBorder)
        Border XML archival.
      • fromXML

        public static javax.swing.border.Border fromXML​(javax.swing.JComponent aComponent,
                                                        RXElement anElement)
        Border XML unarchival.
        Parameters:
        aComponent - the component that borders will be set on
        anElement - the xml node that may (or may not) have a border element in