title: Exception in thread "AWT-EventQueue-1" java.lang.NullPointerException error
body: <p>i'm completely new to any sort or applet programming and my code is really rough. Currently i am making an applet that allows you to learn about different countries based on what continents they are in. It's really simple stuff but i am still struggling. Currently i am receiving the error </p>
  
  <p>Exception in thread "AWT-EventQueue-1" java.lang.NullPointerException</p>
  
  <pre><code>at Culminating1.instructions1(Culminating1.java:69). This line is a simple g.setColor(Color.yellow);.
  </code></pre>
  
  <p>My codes really rough and needs a lot of work so any kind of help is appreciated.</p>
  
  <p>Here is the rest of my code. Thanks a lot!</p>
  
  <pre><code>import java.applet.*;
  import java.awt.*;
  import javax.swing.*;
  import javax.swing.JComponent;
  import java.awt.Color.*;
  
  public class Culminating1 extends Applet {
  
      private Image world, destination, globetrot, rice;
  
      private Button africa, americas, asia, europe, instructions, japan, china, qatar, uae,   thailand;
   private Graphics g = null;
  
      public void init() {
  
          this.setLayout(null);
          asia = new Button("Asia");
          africa = new Button("Africa");
          europe = new Button("Europe");
          americas = new Button("Americas");
          instructions = new Button("Instructions");
          add(asia);
          asia.setBounds(10, 120, 65, 25);
          add(africa);
          africa.setBounds(10, 190, 65, 25);
          add(americas);
          americas.setBounds(10, 260, 65, 25);
          europe.setBounds(10, 330, 65, 25);
          add(europe);
          instructions.setBounds(10, 410, 65, 25);
  
          add(instructions);
          world = getImage(getCodeBase(), "world.gif");
          destination = getImage(getCodeBase(), "Destination2.png");
          globetrot = getImage(getCodeBase(), "GlobeTrot.png");
  
      } // init method
  
       @Override
       public void paint(Graphics g)  
      {
  
          g.setColor(Color.orange);
          g.fillRect(0, 0, 1000, 1000);
          g.drawImage(world, 200, 100, 300, 300, this);
          g.drawImage(destination, 150, 425, 450, 80, this);
          g.drawImage(globetrot, 150, 10, 450, 80, this);
  
      } // paint method
  
      @Override
      public boolean action(Event e, Object o) {
          if (e.target == instructions) {
              instructions1();
          } else if (e.target == asia) {
              asia();
          }
          return false;
      }
  
       public void instructions1() {
          JFrame jp1 = new JFrame();
          Culminating1 a=new Culminating1 ();
          jp1.getContentPane().add(a, BorderLayout.CENTER);
          jp1.setSize(new Dimension(500,500));
          jp1.setVisible(true);
  
          g.setColor(Color.yellow);
          g.fillRect(0, 0, 1000, 1000);
          Font f;
          f = new Font("Broadway", Font.PLAIN, 20);
          g.setFont(f);
          g.setColor (Color.black);
          g.drawString("Welcome to Globe Trot!", 200, 20);
          g.drawString("In this game you will learn about countries around the world.", 200, 40);
          g.drawString("First choose an area of the world,", 200, 80);
          g.drawString("then at random a well known landscape will appear.", 200, 120);
          g.drawString("Your goal is to guess the country where the landscape is from.", 200, 160);
          g.drawString("If you are unable to guess after 10 seconds a flag will appear", 200, 200);
          g.drawString("from the same country. You have one minute to guess the country", 200, 240);
          g.drawString("before you move onto the next country. There are five in total", 200, 280);
      }
  </code></pre>
  
  <p>} // Test class</p>