I create an object (GPolygon), add it to canvas, i rotate it and then i want to reset the rotation, to come back where started. I look at acm page and there is a method called clear() but i can't acces it, probaly because is protected. Text from http://www-cs-faculty.stanford.edu/~eroberts//jtf/javadoc/complete/acm/graphics/GPolygon.html#clear()
How can i use the method clear() on this object?
Here is my Polygon code :
Java
GPolygon patrat=new GPolygon(30,30);
patrat.setFilled(true);
patrat.setColor(Color.RED);
patrat.addVertex(0, 0);
patrat.addEdge(20, 0);
patrat.addEdge(0,20);
add(patrat);
patrat.rotate(10);
Thank you !
You can call patrat.rotate(-10) when you want to reset the rotation.
Typically, the way for you to use the protected clear() method is through inheritance (i.e. MyClass extends GPolygon, etc).