@Override public void paint(final Graphics g) { super.paint(g); if (!EventQueue.isDispatchThread()) { throw new RuntimeException("Wrong thread"); } test(); }