title: java JFrame graphics
body: <p>I have the following simple code in a JFrame constructor</p>
  
  <pre><code>    super(name);
      setBounds(0,0,1100,750);
      setLayout(null);
  
  
      setVisible(true);
  
      g = this.getGraphics();
      int[] x =new int[]{65,  122,  77,  20, };
      int[] y =new int[]{226,  258, 341,  310};
      g.setColor(Color.RED);  
      g.drawPolygon (x, y, x.length);
      System.out.println(g);
  </code></pre>
  
  <p>I get the output on console as: </p>
  
  <blockquote>
    <p>sun.java2d.SunGraphics2D[font=java.awt.Font[family=Dialog,name=Dialog,style=plain,size=12],color=java.awt.Color[r=255,g=0,b=0]]</p>
  </blockquote>
  
  <p>But no red polygon drawn on JFrame but just the blank JFrame.</p>
  
  <p>Why ??</p>