October 2017
Beginner
318 pages
7h 26m
English
Now, let's take a look at how Swing recommends we cause our GUI to come into being. As I said, the swing package provides us some functionality that will perform this vast amount of work and thinking for us. The SwingUtilities class has a static invokeLater method that will create our GUI when no other thread really needs to be processed or when all of the other thinking is done for a bit:
SwingUtilities.invokeLater(null);
This invokeLater method expects us to pass in a Runnable object to it, so we're going to have to create one of the Runnable objects for ourselves:
Runnable GUITask = new Runnable()
The Runnable objects are those that can be converted into a thread of their own. They have a method that we're going ...
Read now
Unlock full access