title: No rectangle shown in JPanel
body: <p>I trying to draw a rectangle in <code>JPanel</code> but the rectangle not showing. What did I missed ?</p>
  
  <p>Here is what I have tried so far. </p>
  
  <pre><code>public class selectSeat extends JFrame {
  
      JPanel panel = new JPanel();
  
      public static void main(String[] args) {
           selectSeat frameTabel = new selectSeat("","","");
      }
  
      public selectSeat(String title, String day, String time)
      {
          super("Select Seat");
          setSize(350,350);
          setLocation(500,280);
          panel.setLayout(null);
          RectDraw rect= new RectDraw();
          panel.add(rect);
  
          getContentPane().add(panel);
          setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          setVisible(true);
  
      }
  
      private static class RectDraw extends JPanel
      {
          protected void paintComponent(Graphics g) {
              super.paintComponent(g);  
               g.drawRect(230,80,10,10);  
               g.setColor(Color.RED);  
               g.fillRect(230,80,10,10);  
              }
  
          public Dimension getPreferredSize() {
              return new Dimension(50, 20); // appropriate constants
            }
  
  
      }
  
  }
  </code></pre>