void (Object variant) { if (!Objects.equals(this.variant, variant)) { this.variant = variant; icons.clear(); if (ExtendableTextComponent.VARIANT.equals(variant)) { JTextComponent component = getComponent(); if (component instanceof ExtendableTextComponent field) { for (Extension extension : field.getExtensions()) { if (extension != null) addExtension(extension); } } } else if (SEARCH_VARIANT_VALUE.equals(variant)) { Object extension = getComponent().getClientProperty("search.extension"); if (extension instanceof Extension) { addExtension((Extension)extension); } addExtension(new SearchExtension()); if (getComponent().getClientProperty("JTextField.Search.HideClearAction") == null) { addExtension(new ClearExtension()); } } } updateIconsLayout(new Rectangle(getComponent().getSize())); // Effectively update margins }