title: Is there a different way to draw on a JPanel?
body: <p>So, I have been having trouble drawing multiple objects on a JFrame, and I know I need to use Layout managers, so I decided to test it with one object before I do multiple, however when I run this code: </p>
  
  <pre><code>        fps = 30;
  
          panel = new JPanel();
  
          frame = new JFrame();
          frame.setLayout(new BorderLayout());
          frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
          frame.setSize(400,400);
          frame.addKeyListener(new key());
  
          running = true;
          update = true;
  
          ball = new Ball(0,0,1);
  
          //panel.setBackground(Color.BLACK);
          panel.add(ball);
          panel.setVisible(true);
  
          frame.add(panel, BorderLayout.CENTER);
          frame.requestFocus();
          frame.setVisible(true);
  
          startTime = System.currentTimeMillis();
  </code></pre>
  
  <p>nothing draws (There is more to the code, i just didnt want to inlcude all of it). However, when I remove the comment and set the background to black, the JFrame turns black. So why is it that it wont draw my Ball object (which i know works) but will change the background? Is there a specific way you need to draw on a JPanel?</p>