Added SwingUtilities.invokeLater() to prevent the NPE exception.