The createDebug() should invoked in UI dispatcher thread!
So should change it to
public EnhancedDebugger(Connection connection, Writer writer, Reader reader) {
this.connection = connection;
this.writer = writer;
this.reader = reader;
try {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
createDebug();
EnhancedDebuggerWindow.addDebugger(EnhancedDebugger.this);
}
});
} catch (InterruptedException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
and should not use invokeLater because it will cause NullPointerException when
initConnection in XMPPConnection class call
addPacketListener(debugger.getReaderListener(), null);