If you want to refer to the current class in a static context, you have to explicitly provide the class name, such as MyClass.class.
posted 4 years ago
Why would you want the class name in a makeButton method?
That makeButton method worries me. There is something very worrying about if (something.equals(item1))...else if (something.equals(item2))...else if... It does not look like object‑oriented programming. There must be a better way to do it.