title: JApplet With Multi Threading
body: <p>I try create two moving object from one class. I want to control they but JApplet doesn't open with threads.</p>
  
  <p>My codes:</p>
  
  <pre><code>import java.awt.Graphics;
  import javax.swing.JApplet;
  
  class RunnableThread extends JApplet implements Runnable{
  
      Thread runner;
      String name;
  
      public RunnableThread(String namex){
          name=namex;
      }    
  
      public void init(){
          setSize(200,300);
      }
  
      public void paint(Graphics g){
          g.drawLine(20, 20, 50, 50);
      }
  
      public void run(){  
          System.out.println("test"+name);            
      }      
  }
  
  
  import java.util.logging.Level;
  import java.util.logging.Logger;
  
  
  public class RunnableTest{    
      public static void main(String args[]){
      RunnableThread bt1=new RunnableThread("test 1"); 
      RunnableThread bt2=new RunnableThread("test 2");     
      Thread btt1=new Thread(bt1);
      Thread btt2=new Thread(bt2);
      btt2.start();
      btt1.start();    
      } 
  }
  </code></pre>