title: Is it possible to turn a shape into a polygon in java?
body: <p>I'm trying to make a Shape into a Polygon. My code looks something like this:
  <br/></p>
  
  <blockquote>
    <p>class MyGraphicMethods extends Graphics
    <br>{
    <br> ...
    <br>...
    <br>public void fillShape(Shape S)
    <br>{
    <br>g.fillPolygon((Polygon)S);
    <br>}</p>
  </blockquote>
  
  <p>When I run</p>
  
  <blockquote>
    <p>public static void main(String[] args) {<br>
            Shape S=new Rectangle(new Dimension(10, 100));<br>
            Polygon P=(Polygon)S;<br>
      }</p>
  </blockquote>
  
  <p>I get a ClassCastException.
  Can Somebody help me?</p>