@Override public Dimension preferredLayoutSize(Container parent) { Dimension d = new Dimension(); // height of highest buddy. for (Component c : BuddySupport.getLeft(textField)) { d.height = Math.max(d.height, c.getPreferredSize().height); } for (Component c : BuddySupport.getRight(textField)) { d.height = Math.max(d.height, c.getPreferredSize().height); } Insets insets = getRealBorderInsets(); d.height += insets.top + insets.bottom; d.width += insets.left + insets.right; Insets outerMargin = BuddySupport.getOuterMargin(textField); if (outerMargin != null) { d.width += outerMargin.left + outerMargin.right; d.height += outerMargin.bottom + outerMargin.top; } return d; }
@Override public Dimension preferredLayoutSize(Container parent) { Dimension d = new Dimension(); // height of highest buddy. for (Component c : BuddySupport.getLeft(textField)) { d.height = Math.max(d.height, c.getPreferredSize().height); } for (Component c : BuddySupport.getRight(textField)) { d.height = Math.max(d.height, c.getPreferredSize().height); } Insets insets = getRealBorderInsets(); d.height += insets.top + insets.bottom; d.width += insets.left + insets.right; Insets outerMargin = BuddySupport.getOuterMargin(textField); if (outerMargin != null) { d.width += outerMargin.left + outerMargin.right; d.height += outerMargin.bottom + outerMargin.top; } return d; }
@Override public void layoutContainer(Container parent) { Rectangle visibleRect = getVisibleRect(); Dimension size; for (Component comp : BuddySupport.getLeft(textField)) { if (!comp.isVisible()) { continue; } size = comp.getPreferredSize(); comp.setBounds(visibleRect.x, centerY(visibleRect, size), size.width, size.height); visibleRect.x += size.width; visibleRect.width -= size.width; } for (Component comp : BuddySupport.getRight(textField)) { if (!comp.isVisible()) { continue; } size = comp.getPreferredSize(); comp.setBounds(visibleRect.x + visibleRect.width - size.width, centerY(visibleRect, size), size.width, size.height); visibleRect.width -= size.width; } }
@Override public Dimension preferredLayoutSize(Container parent) { Dimension d = new Dimension(); // height of highest buddy. for (Component c : BuddySupport.getLeft(textField)) { d.height = Math.max(d.height, c.getPreferredSize().height); } for (Component c : BuddySupport.getRight(textField)) { d.height = Math.max(d.height, c.getPreferredSize().height); } Insets insets = getRealBorderInsets(); d.height += insets.top + insets.bottom; d.width += insets.left + insets.right; Insets outerMargin = BuddySupport.getOuterMargin(textField); if (outerMargin != null) { d.width += outerMargin.left + outerMargin.right; d.height += outerMargin.bottom + outerMargin.top; } return d; }
@Override public Dimension preferredLayoutSize(Container parent) { Dimension d = new Dimension(); // height of highest buddy. for (Component c : BuddySupport.getLeft(textField)) { d.height = Math.max(d.height, c.getPreferredSize().height); } for (Component c : BuddySupport.getRight(textField)) { d.height = Math.max(d.height, c.getPreferredSize().height); } Insets insets = getRealBorderInsets(); d.height += insets.top + insets.bottom; d.width += insets.left + insets.right; Insets outerMargin = BuddySupport.getOuterMargin(textField); if (outerMargin != null) { d.width += outerMargin.left + outerMargin.right; d.height += outerMargin.bottom + outerMargin.top; } return d; }
@Override public void layoutContainer(Container parent) { Rectangle visibleRect = getVisibleRect(); Dimension size; for (Component comp : BuddySupport.getLeft(textField)) { if (!comp.isVisible()) { continue; } size = comp.getPreferredSize(); comp.setBounds(visibleRect.x, centerY(visibleRect, size), size.width, size.height); visibleRect.x += size.width; visibleRect.width -= size.width; } for (Component comp : BuddySupport.getRight(textField)) { if (!comp.isVisible()) { continue; } size = comp.getPreferredSize(); comp.setBounds(visibleRect.x + visibleRect.width - size.width, centerY(visibleRect, size), size.width, size.height); visibleRect.width -= size.width; } }
@Override public void layoutContainer(Container parent) { Rectangle visibleRect = getVisibleRect(); Dimension size; for (Component comp : BuddySupport.getLeft(textField)) { if (!comp.isVisible()) { continue; } size = comp.getPreferredSize(); comp.setBounds(visibleRect.x, centerY(visibleRect, size), size.width, size.height); visibleRect.x += size.width; visibleRect.width -= size.width; } for (Component comp : BuddySupport.getRight(textField)) { if (!comp.isVisible()) { continue; } size = comp.getPreferredSize(); comp.setBounds(visibleRect.x + visibleRect.width - size.width, centerY(visibleRect, size), size.width, size.height); visibleRect.width -= size.width; } }
public static void ensureBuddiesAreInComponentHierarchy(JTextField textField) { for (Component c : BuddySupport.getLeft(textField)) { addToComponentHierarchy(c, Position.LEFT, textField); } for (Component c : BuddySupport.getRight(textField)) { addToComponentHierarchy(c, Position.RIGHT, textField); } }
@Override public void layoutContainer(Container parent) { Rectangle visibleRect = getVisibleRect(); Dimension size; for (Component comp : BuddySupport.getLeft(textField)) { if (!comp.isVisible()) { continue; } size = comp.getPreferredSize(); comp.setBounds(visibleRect.x, centerY(visibleRect, size), size.width, size.height); visibleRect.x += size.width; visibleRect.width -= size.width; } for (Component comp : BuddySupport.getRight(textField)) { if (!comp.isVisible()) { continue; } size = comp.getPreferredSize(); comp.setBounds(visibleRect.x + visibleRect.width - size.width, centerY(visibleRect, size), size.width, size.height); visibleRect.width -= size.width; } }
public static void ensureBuddiesAreInComponentHierarchy(JTextField textField) { for (Component c : BuddySupport.getLeft(textField)) { addToComponentHierarchy(c, Position.LEFT, textField); } for (Component c : BuddySupport.getRight(textField)) { addToComponentHierarchy(c, Position.RIGHT, textField); } }
public static void ensureBuddiesAreInComponentHierarchy(JTextField textField) { for (Component c : BuddySupport.getLeft(textField)) { addToComponentHierarchy(c, Position.LEFT, textField); } for (Component c : BuddySupport.getRight(textField)) { addToComponentHierarchy(c, Position.RIGHT, textField); } }
public static void ensureBuddiesAreInComponentHierarchy(JTextField textField) { for (Component c : BuddySupport.getLeft(textField)) { addToComponentHierarchy(c, Position.LEFT, textField); } for (Component c : BuddySupport.getRight(textField)) { addToComponentHierarchy(c, Position.RIGHT, textField); } }
for (Component comp : BuddySupport.getLeft(textField)) { insets.left += comp.isVisible() ? comp.getPreferredSize().width : 0;
for (Component comp : BuddySupport.getLeft(textField)) { insets.left += comp.isVisible() ? comp.getPreferredSize().width : 0;
for (Component comp : BuddySupport.getLeft(textField)) { insets.left += comp.isVisible() ? comp.getPreferredSize().width : 0;
for (Component comp : BuddySupport.getLeft(textField)) { insets.left += comp.isVisible() ? comp.getPreferredSize().width : 0;