title: Drawing circles in Java
body: <p>I have a problem to create circle whenever I like to call the paint function it will draw me another circle. Here is my code:</p>
  
  <pre><code>import java.awt.*;
  import javax.swing.*;
  
  public class MyOnto extends JFrame
  {
      int weight = 960;
      int heigh = 960;
      int x  = 200;
      int y = 100;
  
      //Graphics p;
  
      private static MyOnto my = new MyOnto();
  
      public MyOnto()
      {
              setTitle("My Ontology");
              setSize(weight, heigh);
              setVisible(true);
              setDefaultCloseOperation(EXIT_ON_CLOSE);
      }
  
      public void paint(Graphics g)
      {
              g.setColor(Color.black);
              drawing(g,x,y,100,50);  //g, x ,y, w, h of circle
      }
  
      public void drawing(Graphics g, int x, int y, int w, int h)
      {
              g.drawOval(x,y,w,h);
              g.drawString("Helo", x+25,y+20);
              x = x + 100;
              y = y + 100;
      }
  
      public static void main(String[] args)
      {
              //my = new MyOnto();
              my.paint(null);
              my.paint(null); //try to print one more circle
      }
  </code></pre>
  
  <p>}</p>
  
  <p>The output is always just one circle. How can I make it like a function call whenever I want to draw extra one circle it will just a simple call a function? </p>