Package org.jdesktop.swingx.plaf
Class BuddyLayoutAndBorder
- java.lang.Object
-
- org.jdesktop.swingx.plaf.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
-
-
Constructor Summary
Constructors Constructor Description BuddyLayoutAndBorder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddLayoutComponent(java.lang.String name, java.awt.Component comp)Does nothing.protected intcenterY(java.awt.Rectangle rect, java.awt.Dimension size)javax.swing.border.BordergetBorderDelegate()java.awt.InsetsgetBorderInsets(java.awt.Component c)Returns theInsetsof the originalBorderplus the space required by the child components.java.awt.InsetsgetRealBorderInsets()Returns the insets of the original border (without the margin! Beware ofBasicBorders.MarginBorder!).protected java.awt.RectanglegetVisibleRect()protected voidinstall(javax.swing.JTextField textField)Installs aBuddyLayoutAndBorderas a layout and border of the given text field.booleanisBorderOpaque()voidlayoutContainer(java.awt.Container parent)java.awt.DimensionminimumLayoutSize(java.awt.Container parent)voidpaintBorder(java.awt.Component c, java.awt.Graphics g, int x, int y, int width, int height)java.awt.DimensionpreferredLayoutSize(java.awt.Container parent)voidpropertyChange(java.beans.PropertyChangeEvent evt)voidremoveLayoutComponent(java.awt.Component comp)Does nothing.protected voidreplaceBorderIfNecessary()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.StringtoString()voiduninstall()
-
-
-
Method Detail
-
install
protected void install(javax.swing.JTextField textField)
Installs aBuddyLayoutAndBorderas a layout and border of the given text field. Registers aPropertyChangeListenerto 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:
addLayoutComponentin interfacejava.awt.LayoutManager- See Also:
BuddySupport#add(javax.swing.JComponent, Position, JTextField)
-
minimumLayoutSize
public java.awt.Dimension minimumLayoutSize(java.awt.Container parent)
- Specified by:
minimumLayoutSizein interfacejava.awt.LayoutManager
-
preferredLayoutSize
public java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
- Specified by:
preferredLayoutSizein interfacejava.awt.LayoutManager
-
removeLayoutComponent
public void removeLayoutComponent(java.awt.Component comp)
Does nothing.- Specified by:
removeLayoutComponentin interfacejava.awt.LayoutManager- See Also:
BuddySupport.remove(javax.swing.JComponent, JTextField)
-
layoutContainer
public void layoutContainer(java.awt.Container parent)
- Specified by:
layoutContainerin interfacejava.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 theInsetsof the originalBorderplus the space required by the child components.- Specified by:
getBorderInsetsin interfacejavax.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 ofBasicBorders.MarginBorder!).- Returns:
- the insets of the border delegate
-
isBorderOpaque
public boolean isBorderOpaque()
- Specified by:
isBorderOpaquein interfacejavax.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:
paintBorderin interfacejavax.swing.border.Border
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent evt)
- Specified by:
propertyChangein interfacejava.beans.PropertyChangeListener
-
uninstall
public void uninstall()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-