Class BuddyLayoutAndBorder

  • All Implemented Interfaces:
    java.awt.LayoutManager, java.beans.PropertyChangeListener, java.util.EventListener, javax.swing.border.Border, javax.swing.plaf.UIResource

    public class BuddyLayoutAndBorder
    extends java.lang.Object
    implements java.awt.LayoutManager, javax.swing.border.Border, java.beans.PropertyChangeListener, javax.swing.plaf.UIResource
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addLayoutComponent​(java.lang.String name, java.awt.Component comp)
      Does nothing.
      protected int centerY​(java.awt.Rectangle rect, java.awt.Dimension size)  
      javax.swing.border.Border getBorderDelegate()  
      java.awt.Insets getBorderInsets​(java.awt.Component c)
      Returns the Insets of the original Border plus the space required by the child components.
      java.awt.Insets getRealBorderInsets()
      Returns the insets of the original border (without the margin! Beware of BasicBorders.MarginBorder!).
      protected java.awt.Rectangle getVisibleRect()  
      protected void install​(javax.swing.JTextField textField)
      Installs a BuddyLayoutAndBorder as a layout and border of the given text field.
      boolean isBorderOpaque()  
      void layoutContainer​(java.awt.Container parent)  
      java.awt.Dimension minimumLayoutSize​(java.awt.Container parent)  
      void paintBorder​(java.awt.Component c, java.awt.Graphics g, int x, int y, int width, int height)  
      java.awt.Dimension preferredLayoutSize​(java.awt.Container parent)  
      void propertyChange​(java.beans.PropertyChangeEvent evt)  
      void removeLayoutComponent​(java.awt.Component comp)
      Does nothing.
      protected void replaceBorderIfNecessary()
      Wraps and replaces the text fields default border with this object, to honor the button margins and sizes of the search, clear and popup buttons and the layout style.
      java.lang.String toString()  
      void uninstall()  
      • Methods inherited from class java.lang.Object

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

      • BuddyLayoutAndBorder

        public BuddyLayoutAndBorder()
    • Method Detail

      • install

        protected void install​(javax.swing.JTextField textField)
        Installs a BuddyLayoutAndBorder as a layout and border of the given text field. Registers a PropertyChangeListener to wrap any subsequently set border on the text field.
      • getBorderDelegate

        public javax.swing.border.Border getBorderDelegate()
      • replaceBorderIfNecessary

        protected void replaceBorderIfNecessary()
        Wraps and replaces the text fields default border with this object, to honor the button margins and sizes of the search, clear and popup buttons and the layout style.
      • addLayoutComponent

        public void addLayoutComponent​(java.lang.String name,
                                       java.awt.Component comp)
        Does nothing.
        Specified by:
        addLayoutComponent in interface java.awt.LayoutManager
        See Also:
        BuddySupport#add(javax.swing.JComponent, Position, JTextField)
      • minimumLayoutSize

        public java.awt.Dimension minimumLayoutSize​(java.awt.Container parent)
        Specified by:
        minimumLayoutSize in interface java.awt.LayoutManager
      • preferredLayoutSize

        public java.awt.Dimension preferredLayoutSize​(java.awt.Container parent)
        Specified by:
        preferredLayoutSize in interface java.awt.LayoutManager
      • layoutContainer

        public void layoutContainer​(java.awt.Container parent)
        Specified by:
        layoutContainer in interface java.awt.LayoutManager
      • centerY

        protected int centerY​(java.awt.Rectangle rect,
                              java.awt.Dimension size)
      • getVisibleRect

        protected java.awt.Rectangle getVisibleRect()
        Returns:
        the rectangle allocated by the text field, including the space allocated by the child components left and right, the text fields original border insets and the outer margin.
      • getBorderInsets

        public java.awt.Insets getBorderInsets​(java.awt.Component c)
        Returns the Insets of the original Border plus the space required by the child components.
        Specified by:
        getBorderInsets in interface javax.swing.border.Border
        See Also:
        Border.getBorderInsets(java.awt.Component)
      • getRealBorderInsets

        public java.awt.Insets getRealBorderInsets()
        Returns the insets of the original border (without the margin! Beware of BasicBorders.MarginBorder!).
        Returns:
        the insets of the border delegate
      • isBorderOpaque

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

        public void propertyChange​(java.beans.PropertyChangeEvent evt)
        Specified by:
        propertyChange in interface java.beans.PropertyChangeListener
      • uninstall

        public void uninstall()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object