title: Java applet "Invalid top level statement" error
body: <p>I am making a maze game in java using applets and I implemented a switch case on my image so that if I win I can go to the next image. But when I try to run it in the interactions panel (because the image is too big for the default applet size) using 
  import edu.rice.cs.plt.swing.SwingUtil; SwingUtil.showApplet(new mazeGameTest(), 700, 700); 
  it gives me an error saying Invalid top level statement. </p>
  
  <pre><code> Image backImage; 
   BufferedImage image=null;
   int[] dataBuffInt;
  switch(flag){
    case 0: try { 
  image = ImageIO.read(new File("firstMaze.jpg")); 
  } 
  catch (IOException e) { System.out.println("image did not load"); }
    break;
    }
  dataBuffInt = image.getRGB(0, 0, this.getSize().width, this.getSize().height, null, 0, this.getSize().width); 
  </code></pre>
  
  <p>I searched the internet but their solution doesn't solve this problem.
  Thanks in advance.</p>