for(Shape shape : MyPanel.shapes){
save.write(shape.getClass().getName() + "\n");
save.write(shape.getX() + "\n");
save.write(shape.getY() + "\n");
if(shape instanceof Line){
Line tmpLine = new Line();
tmpLine = (Line) shape;
save.write(tmpLine.getX_() + "\n");
save.write(tmpLine.getY_() + "\n");
}
if(shape instanceof Oval){
Oval tmpOval = new Oval();
tmpOval = (Oval) shape;
save.write(tmpOval.getWidth()+ "\n");