Thanks, but I allready know it ;D
public void create(Shape shape)
{
double doubles[] = new double[6];
Point2D.Double pt = null;
Point2D.Double lastPoint = null;
Point2D.Double lastMove = null;
clear();
PathIterator it = shape.getPathIterator(null, 0.25);
//PathIterator it = shape.getPathIterator(null);
while(!it.isDone())
{
int type = it.currentSegment(doubles);
switch(type)
{
case PathIterator.SEG_LINETO :
pt = new Point2D.Double(doubles[0],doubles[1]);
if (pt.distance(lastPoint)>0.0001)
{
addPoint( pt );
lastPoint = pt;
}
break;
case PathIterator.SEG_MOVETO :
pt = new Point2D.Double(doubles[0],doubles[1]);
if (lastMove != null)
{
if (current.get(current.size()-1).distance(lastMove)<0.0001)
{
current.remove(current.size()-1);
}
}
newPolygone();
addPoint( pt );
lastPoint = pt;
lastMove = pt;
break;
case PathIterator.SEG_CLOSE :
break;
default :
}
it.next();
}
if (lastMove != null)
{
if (current.get(current.size()-1).distance(lastMove)<0.0001)
{
current.remove(current.size()-1);
}
}
}
But there is something even greater in Java 2D, it can generate a shape form an outline style and a filling shape :
createPath(p);
if (style.fill != null)
{
GL11.glColor3f((float)style.fill.getRed()/255.0f,
(float)style.fill.getGreen()/255.0f,
(float)style.fill.getBlue()/255.0f);
drawGlShape(path);
}
if(style.stroke != null)
{
GL11.glColor3f((float)style.stroke.getRed()/255.0f,
(float)style.stroke.getGreen()/255.0f,
(float)style.stroke.getBlue()/255.0f);
Shape outLinePath = style.getBasicStroke().createStrokedShape(path);
drawGlShape(outLinePath);
}