I have some problems with my code. For some reason my thread.start() doesn't activate my run() method. In pure desperation I have simply replaced my code in run() with a printing function, but nothing is being printed. Can someone help me by explaining what is wrong in my code?
public class Screen extends JPanel implements Runnable{
Thread thread = new Thread();
Frame frame;
public Screen(Frame frame){
this.frame = frame;
frame.setSize(horizontal * 25 + 24 , (vertical) * 25 + 48);
this.frame.addKeyListener(new KeyHandler(this));
thread.start();
}
public void run(){
System.out.println("Boom");
}
}
I got a lot of stuff in between and under this code, but this is the only part essential to the thread and frame.