just to preface, I am very new to java. So expect dumb mistakes.
I am trying to do a project with java's drawing panel, within BlueJ, and I cannot figure out how to make a program that has a moving object. This is a project, so the code is provided. We are having to modify it in whatever way we want. We are not able to add any other packages.
I know it has to do with some sort of loop, but I am making some type of mistake where it is just printing a ton of circles, instead of a new type every time I press refresh. Here is the code.
import java.awt.*;
import javax.swing.*;
public class DrawingPanel extends JPanel {
  public void paintComponent(Graphics g)
  {
   // clear screen
    g.setColor(Color.white);
    g.clearRect(0,0,500,500);
    {
      System.out.printf("Spring Design Barker Spring 2018%n");
      int x = 125;
      int y = 125;
      int w = 50;
      int h =80;
      int b = 50;
      int rd = 255 ;    
      int gn = 255 ;    
      int bl = 0 ;
      Circle c1,c2;
      Rectangle r1,r2;
      Triangle t1,t2;
      Color clr1,c;
      clr1 = new Color(rd,gn,bl);  
      r1 = new Rectangle(x,y,w,h,clr1);
      clr1 = new Color(106,96,200);  
      t1=new Triangle(x,y,w,h,clr1);
      clr1 = new Color(220,15,15);  
      c1=new Circle(x,25,25,clr1);
      r1.draw(g);      /*display the rectangle  */
      t1.draw(g);      /*display the triangle  */
      c1.draw(g);      /*display the circle  */
      t1.setH(-h);      /*display the triangle  */
      t1.setColor(new Color(15,220,15));      /*display the triangle  */
      t1.draw(g);      /*display the triangle  */
      x=200;
      y=200;
      for(int k=0;k<9;k++)
       {
         c=new Color(255-k*20,0+k*15,0+k*25);   // vary color
         c1=new Circle(200,10 * k,50,c);
         c1.draw(g);      /*display the new circle  */
       }
      //c=new Color(0,255,0);   // change paint in can to green
      //c2=new Circle(300,50,10,c);
      //c2.draw(g);      /*display the new circle  */
    }
  }
}