title: How to make star shape in Java?
body: <p>I'm trying to make some shapes with Java. I created two rectangles with two different colors but I want to create a star shape and I can't find useful source to help me doing this.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>import java.awt.*;
  import javax.swing.*;
  
  public class shapes extends JPanel{
  
      @Override
      public void paintComponent(Graphics GPHCS){
          super.paintComponent(GPHCS);
  
          GPHCS.setColor(Color.BLUE);
          GPHCS.fillRect(25,25,100,30);
  
          GPHCS.setColor(Color.GRAY);
          GPHCS.fillRect(25,65,100,30);
  
          GPHCS.setColor(new Color(190,81,215));
          GPHCS.drawString("This is my text", 25, 120);
      }
  }
  </code></pre>