What do you mean by, "will it affect the main thread?"
In short, your example above won't affect the main thread at all. But that's just because you haven't written anything in there to cause it to do so.
However, you can, if you wish, have threads branch off of the main thread and then report back to the main thread of progress, results, exceptions, using notify(), Future, etc. It just depends on what you want your worker thread to do.
Now, I did notice you said something in your example of using the thread to build up panels. Are you trying to create GUI controls in this thread? If so, use SwingUtilities.invokeLater() to create your GUI controls on the Event Dispatch Thread. The reason for this is because Java expects you to do all Swing work in the Event Dispatch Thread. Here's an example of a generally accepted good practice for affecting your Swing controls from the EDT:
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
JPanel panel = new JPanel();
// initialize panel here.
container.add(panel); // where 'container' is some Swing Container that you're adding panel to.
}
});
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
– Douglas Hofstadter, Gödel, Escher, Bach: An Eternal Golden Braid