Instead of setSize() use pack() to take advantage of the carefully calculated preferred component size. You will also need to initialize your shortcut:
labels[i] = new JLabel("10000000000000000000000000000000000000");
Also consider javax.swing.Timer instead of a separate thread.
Addition. Conveniently, each Swing Timer has a common background thread, and actionPerformed() is called in the event dispatch thread. An alternative to SwingWorker is illustrated here .
trashgod
source share