Here you can find the source of hasClass(AttributeSet attr, String className)
public static boolean hasClass(AttributeSet attr, String className)
//package com.java2s; //License from project: LGPL import javax.swing.text.AttributeSet; import javax.swing.text.html.HTML.Attribute; public class Main { public static boolean hasClass(AttributeSet attr, String className) { String classValue = (String) attr.getAttribute(Attribute.CLASS); if (classValue == null) { return false; }// w w w.jav a2 s . c o m String[] classNames = classValue.split(" "); for (String c : classNames) { if (c.equals(className)) { return true; } } return false; } }