title: Create the square, rectangle, triangle of java in jframe
body: <p>I have a problem with Java As I understood not come Draw Geometric figures in Java, the code and the Following you can help me?</p>
  
  <p>This is the code:</p>
  
  <pre><code>public class Gioco {
  
  
      public static void main (String args [])
      {
          PaintRect();
  
      }
  
      public static void PaintRect() {
  
          g.drawRect(100,100,300,300);
          g.drawLine(100,100,100,100);
          g.setBackground(Color.BLACK);
          System.out.println("Trasut");
          credits.setText("Kitebbiv");
          credits.setBackground(null);
          credits.setEditable(false);
          credits.setFocusable(false);
          credits.setBounds(0,0,100,100);
          credits.setForeground(Color.BLACK);
          panel.add(credits);
          g.getPaint();
      }
  </code></pre>
  
  <p>How can I create a <code>JFrame</code> the triangle, square and rectangle? correct my code thanks</p>