title: Calling the paint() method from another class?
body: <p>I am trying to call the <code>paint()</code> method from another class, but it just doesn't work.</p>
  
  <p>Here is the code:</p>
  
  <p><code>Main.java</code>:</p>
  
  <pre><code>public class Main extends JFrame {
      private static final long serialVersionUID = 1L;
  
      private int WIDTH = 600;
      private int HEIGHT = 400;
      private String NAME = "Dark Ages";
      private String VERSION = "0.0.1 Pre-Alpha";
      static boolean running = false;
  
      private Image dbImage;
      private Graphics dbg;
  
      public Main() {
          //Initialize window
          JFrame frame = new JFrame();
          frame.setTitle(NAME + " - " + VERSION);
          frame.setSize(WIDTH, HEIGHT);
          frame.setVisible(true);
          frame.setResizable(false);
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.setLocationRelativeTo(null);
  
          //Running
          running = true;
      }
  
      public void paint(Graphics g) {
          dbImage = createImage(getWidth(), getHeight());
          dbg = dbImage.getGraphics();
          paintComponent(dbg);
          g.drawImage(dbImage, 0, 0, this);
      }
  
      public void paintComponent(Graphics g) {
          // Draw Images
          repaint();
      }
  
      public static void main(String args[]) {
          new Main();
          Player player = new Player();
      }
  }
  </code></pre>
  
  <p><code>Player.java</code>:</p>
  
  <pre><code>public class Player {
  
      public void paint(Graphics g) {
          g.drawRect(100, 100, 100, 100);
      }
  
  }
  </code></pre>