private static Method getBRBIMethod(Component component) { Class klass = component.getClass(); while (klass != null) { if (BRB_I_MAP.containsKey(klass)) { Method method = (Method) BRB_I_MAP.get(klass); return method; } klass = klass.getSuperclass(); } klass = component.getClass(); Method[] methods = klass.getMethods(); for (int i = methods.length - 1; i >= 0; i--) { Method method = methods[i]; if ("getBaselineResizeBehaviorInt".equals(method.getName())) { Class[] params = method.getParameterTypes(); if (params.length == 0) { BRB_I_MAP.put(klass, method); return method; } } } BRB_I_MAP.put(klass, null); return null; }