code: private static Method getMethodDrawString() {
          try {
              Class<?> clazz = Class.forName(SWING_UTILITIES2_NAME);
              return clazz.getMethod(
                      "drawString",
                      new Class[]{JComponent.class, Graphics.class, String.class, Integer.TYPE, Integer.TYPE}
              );
          } catch (ClassNotFoundException e) {
              // returns null
          } catch (SecurityException e) {
              // returns null
          } catch (NoSuchMethodException e) {
              // returns null
          }
          return null;
      }
docs: Private Helper Code ****************************************************