My question is, does addNotify () run automatically?
Yes. Exact where and when it depends on the internal components of the AWT implementation.
What is this goal
This is as described in javadoc . This is a very low-level material that is part of the “glue” that connects the AWT world to the native world of windows. (I am intentionally high-level and vague. If you want detailed details, download and read the OpenJDK source code.)
and what happens when I redefine it
You probably violate AWT :-)
and besides, why don't I want to override this method?
I cannot come up with a good reason for this ... unless you are trying to connect AWT to another operating system or another native windows system.
source share