Related to your question:
this
refer to the instance of inner class. You have to use
Loading.this.dispose()
.
Most important
Calling jpb.repaint();
in another thread that is not the EDT can cause unexpected behaviour, and calling Thread.sleep(30);
is gonna to freeze your gui. Instead use a SwingTimer
Read more: How to use SwingTimers | Concurrency in Swing