title: Java Paint component not working
body: <p>Here's the code, the square renders but will not move, even though it should render each loop. The problem appears to be in the Core class, in run()</p>
  
  <pre><code>    package com.game;
  
  import java.awt.*;
  import javax.swing.*;
  
  public class Core implements Runnable{
      private static boolean running = true;
      public static JFrame frame = new JFrame();
      public static void main(String[] args) {
          frame.setResizable(false);
          frame.setBounds(100,100,600,400);
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.setVisible(true);
          start();
      }
  
  
  
  
  
  package com.game;
  
  import java.awt.Graphics;
  
  import javax.swing.JPanel;
  
  public class Paint extends JPanel{
      public static int x = 10;
      public void paintComponent(Graphics g){
          super.paintComponent(g);
  
          g.fillRect(x,10,100,100);
      }
  }
  
  
          private static void start() {
              running = true;
              Thread thread = new Thread(new Core());
              thread.setPriority(Thread.MAX_PRIORITY);
              thread.start();
          }
  
          @Override
          public void run() {
              Paint p = new Paint();
              Container pane = frame.getContentPane();
              while(running){
                  pane.add(p);
                  pane.show();
  
                  System.out.println(Paint.x);
              try {
                  Thread.sleep(100);
              } catch (Exception e){}
          }
          }
      }
  </code></pre>
  
  <p>sorry if the code is annoying in any way, I'm not sure how I should format it...</p>