title: Java - override paint(Graphics g) Method from >variable<
body: <p>I have a <code>Canvas</code> variable in my class. How can I override the <code>paint()</code> method from <code>Canvas</code>?. I know that you can create a separate class and extend <code>Canvas</code>, but in this case I want to keep my variable.</p>
  
  <pre><code>//This is the method i am looking for
    public void paint(Graphics g) {
       super.paint(g)
    }
  </code></pre>
  
  <p>Here's my class:</p>
  
  <pre><code>private JFrame frame;
  private Canvas canvas;
  
  public SimpleSkinCreator() {
      canvas = new Canvas();
      canvas.setPreferredSize(new Dimension(WIDTH, HEIGHT));
      canvas.setBackground(Color.black);
      canvas.setFocusable(true);
      canvas.requestFocus();
  
      frame = new JFrame("AvarionDE's - SimpleSkinEditor");
      frame.add(canvas);
      frame.pack();
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.setLocationRelativeTo(null);
      frame.setVisible(true);
  }
  </code></pre>