title: (Javax swing) repaint() sometimes not calling paintComponent()
body: <p>I tried to find a question that answers my problem but could not find any since the questions asked are about that repaint() is never called</p>
  
  <p>My problem is that when i start the application it either works without problems, or that <strong>only</strong> paintComponent() is not called (there are no errors)</p>
  
  <p>My code:
  GamePanel.java:</p>
  
  <pre><code>    public class GamePanel extends JPanel implements KeyListener, ActionListener {
  
      private static final long serialVersionUID = 1819637299730865623L;
  
      private Timer time;
      private long oldTime;
      private int Width;
      private int Height;
  
  
      public GamePanel(int Width, int Height) {
          this.Width = Width;
          this.Height = Height;
          addKeyListener(this);
          setFocusable(true);
          setFocusTraversalKeysEnabled(true);
          oldTime = System.nanoTime();
          setup();
          System.console().printf("Begin!");
          time = new Timer(0,this);
          time.start();
      }
      @Override
      public void actionPerformed(ActionEvent e) {
          update(((float)(System.nanoTime() - oldTime)) / (float)1000000000);
          System.console().printf("Running!");
          oldTime = System.nanoTime();
          repaint();
          time.start();
      }
  
  
  
  
  
      float x = 0;
      float del;
  
      @Override
      public void paintComponent(Graphics g) {
          System.console().printf("Drawing!");
          g.setColor(new Color(0,0,0));
          g.fillRect(0, 0, Width, Height);
          g.setColor(new Color(0,0,255));
          g.fillOval((int)x-40,60,80,80);
          g.setColor(new Color(255,255,255));
          g.drawString(Float.toString(1 / del), Width / 2, Height / 2);
  
          g.dispose();
      }
  
      public void update(float delta) {
          x += delta * 50;
          del = delta;
      }
  
      public void setup() {
  
      }
  </code></pre>
  
  <p>Renderer.java (this is created in the main function)</p>
  
  <pre><code>    public class Renderer {
      int Height, Width;
      JFrame obj;
      GamePanel pan;
  
      public Renderer(int Width, int Height, int StartposX, int StartposY, String title) {
          obj = new JFrame();
          this.Height = Height;
          this.Width = Width;
  
          obj.setBounds(StartposX,StartposY,Width,Height);
          obj.setTitle(title);
          obj.setResizable(false);
          obj.setVisible(true);
          obj.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          pan = new GamePanel(Width,Height);
          obj.add(pan);
      }
  
  }
  </code></pre>