Problems with images in JFrames
Hi this error keeps coming up when I try to compile my code.
agame.java:9 cannot find symbol
symbol : method getDefaultToolkit()
location: class java.awt.Toolkit
Image backimage = Toolkit.getDefaultToolkit().getImage("backimage");
/\
1 error
Here is my code, I know you don't need it all but I don't know where it is going wrong.
import java.awt.*;
import javax.swing.*;
class agameextends JFrameimplements Runnable
{
Thread runner;
Boolean gameover =false;
Boolean running =true;
Image backimage = Toolkit.getDefautlToolkit().getImage("backimage.gif");
public agame()
{
super("Game");
setSize(500, 500);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
Container contentArea = getContentPane();
gamepanel gameDisplay =new gamepanel();
contentArea.add(gameDisplay);
setContentPane(contentArea);
start();
}
class gamepanelextends JPanel
{
publicvoid paintComponent(Graphics g)
{
g.drawImage(backimage, 0, 0,this);
}
}
publicvoid start()
{
setVisible(true);
requestFocus();
running =true;
runner =new Thread(this);
runner.start();
}
publicvoid stopgame()
{
if(running !=null)
running =null;
}
publicvoid destroy()
{
}
publicvoid gameupdate()
{
if(!gameover)
{
}
}
publicvoid run()
{
while (runner == Thread.currentThread() )
{
gameupdate();
repaint();
try
{
Thread.sleep(20);
}
catch(InterruptedException e){}
}
}
publicstaticvoid main(String[] args)
{
agame eg =new agame();
}
}

