BuddyLayoutAndBorder implements LayoutManager, Border, PropertyChangeListener, UIResource { public void uninstall() { if (textField != null) { textField.removePropertyChangeListener("border", this); if (textField.getBorder() == this) { textField.setBorder(borderDelegate); } textField.setLayout(null); textField = null; } }  Border getBorderDelegate(); @Override void addLayoutComponent(String name, Component comp); @Override Dimension minimumLayoutSize(Container parent); @Override Dimension preferredLayoutSize(Container parent); @Override void removeLayoutComponent(Component comp); @Override void layoutContainer(Container parent); @Override Insets getBorderInsets(Component c); Insets getRealBorderInsets(); @Override boolean isBorderOpaque(); @Override void paintBorder(Component c, Graphics g, int x, int y, int width, int height); @Override void propertyChange(PropertyChangeEvent evt); void uninstall(); @Override String toString();  }
@Test public void testUninstall() throws Exception { blab.uninstall(); Border newBorder = BorderFactory.createEmptyBorder(); textField.setBorder(newBorder); assertSame("Border should NOT have been wrapped.", newBorder, textField.getBorder()); }