Fixed NPE from occurring.
The mainPointer variable was being accessed by the AWT event thread
before construction of the object was completed.