mikey strauss wrote:i did not know about it till i allready built the class
So get rid of your "point" class and convert your code to use the standard "Point" class. Don't reinvent the wheel, espcially when you don't follow Java class naming conventions.
the Thread.sleep sould stop the first (4-point) polygon from changing for some time then when the move()
is called the JPanel sould clear and the second (4-point) polygon sould apeer with out there remains of the first one
sould not lokk like an airplane tail-(5-point polygon)
i did not understand way it is a progam that has to be run from debuging...
Thread.sleep causes the main thread (Event Dispatch Thread, EDT) to sleep, in that half of second the application hangs.
And even if it draws that first polygon before call to move() the super.painComponent(g) will clear that and then it draws that polygon after move()...
Maybe you could call move() in painComponent(Graphics) method... and for the second polygone create a new GeneralPath.
Debugging is finding bugs
mikey strauss wrote:OK thanks i got it i do not know why but the casting from graphics to graphics2D was the problem
some how whin i only used graphics it worked fine
What are you doing now? It doesn't even compile when you use the Graphics Object. the fill(...) and draw(...) methods of defined in the Graphics2D class.
Anyway if I understand your original problem its because you are trying to reuse the same GeneralPath method. I think code like the following is what you are trying to do: