title: Java-Image not drawing to screen
body: <p>I am trying to draw an image to the screen using Java. The problem is that it does not appear and no errors occur.</p>
  
  <pre><code>import javax.imageio.ImageIO;
  import javax.swing.*;
  import java.awt.*;
  import java.awt.event.*;
  import java.awt.image.BufferedImage;
  import java.io.IOException;
  
  public class GameClass extends JPanel implements ActionListener, KeyListener{
  
      private BufferedImage image;
  
      public GameClass(){
          Timer time = new Timer(15, this);
          time.start();
          this.addKeyListener(this);
          this.setFocusable(true);
      }
  
      public void openImage(){
          try {
              image = ImageIO.read(this.getClass().getResource("spaceship.png"));
          } catch (IOException e) {
              System.out.println("An error occurred!");
          }
      }
  
      public void paintComponent(Graphics g){
          g.setColor(Color.BLACK);
          g.fillRect(0, 0, Main.WW, Main.WH);
          g.drawImage(image,Main.WW/2,Main.WH/2,null);
      }
  
      public void actionPerformed(ActionEvent e){
          repaint();
      }
  
      public void keyPressed(KeyEvent e){
      }
  
      public void keyReleased(KeyEvent e){
      }
  
      public void keyTyped(KeyEvent e){
  
      }
  }
  </code></pre>