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 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 theInsets
of the originalBorder
plus the space required by the child components.java.awt.Insets
getRealBorderInsets()
Returns the insets of the original border (without the margin! Beware ofBasicBorders.MarginBorder
!).protected java.awt.Rectangle
getVisibleRect()
protected void
install(javax.swing.JTextField textField)
Installs aBuddyLayoutAndBorder
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()
-
-
-
Method Detail
-
install
protected void install(javax.swing.JTextField textField)
Installs aBuddyLayoutAndBorder
as a layout and border of the given text field. Registers aPropertyChangeListener
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 interfacejava.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 interfacejava.awt.LayoutManager
-
preferredLayoutSize
public java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
- Specified by:
preferredLayoutSize
in interfacejava.awt.LayoutManager
-
removeLayoutComponent
public void removeLayoutComponent(java.awt.Component comp)
Does nothing.- Specified by:
removeLayoutComponent
in interfacejava.awt.LayoutManager
- See Also:
BuddySupport.remove(javax.swing.JComponent, JTextField)
-
layoutContainer
public void layoutContainer(java.awt.Container parent)
- Specified by:
layoutContainer
in 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 theInsets
of the originalBorder
plus the space required by the child components.- Specified by:
getBorderInsets
in 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:
isBorderOpaque
in 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:
paintBorder
in interfacejavax.swing.border.Border
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent evt)
- Specified by:
propertyChange
in interfacejava.beans.PropertyChangeListener
-
uninstall
public void uninstall()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-