Multithreading extended panel <p>I'm trying to allocate a <code>JPanel</code> that implements <code>Runnable</code> interface in a <code>JFrame</code>. I'd made this sample for interpret my idea. I want to add a multi-threading panel that shows a text as demo to a window with a <code>String</code> as parameter of a new instance. The panel should have independent process so I implemented <code>Runnable</code> interface. But when I try to create a new instance o panel with a new instance of my class, It doesn't work.</p> <p>What I am doing wrong?</p> <p>imagePanel Panel class:</p> <pre><code>public class imagePanel extends JPanel implements Runnable{ JLabel imageTest; public imagePanel(String textLabel) { this.setPreferredSize(new Dimension(300,300)); imageTest = new JLabel(textLabel); imageTest.setPreferredSize(this.getPreferredSize()); } public void setImageText(String newText){ imageTest.setText(newText); } public void run(){ this.add(imageTest); } } </code></pre> <p>Main class test class:</p> <pre><code>public class test { public static void main(){ JFrame frame = new JFrame("Test Window"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setPreferredSize(new Dimension(300,300)); JPanel panel = new imagePanel("Text label"); panel.setPreferredSize(frame.getPreferredSize()); frame.add(panel); frame.setVisible(true); } } </code></pre>