/** * Searchs the attribute behavior (SimpleAttributeModifier or AttibuteApendModifier) with the given attribute name and * returns it if found, otherwise null. * * @param comp * @param name Name of attribute. */ public static AttributeModifier getAttributeModifier(final Component comp, final String name) { for (final Behavior behavior : comp.getBehaviors()) { if (behavior instanceof AttributeAppender && name.equals(((AttributeAppender) behavior).getAttribute()) == true) { return (AttributeAppender) behavior; } else if (behavior instanceof AttributeModifier && name.equals(((AttributeModifier) behavior).getAttribute()) == true) { return (AttributeModifier) behavior; } } return null; }