I have the following method:
private void setFilledAndAdd(Shape obj, Color col, int x, int y) {
obj.setFilled(true); // needs interface Fillable
obj.setFillColor(col);
add(obj, x, y); // needs children of Shape (or Shape itself)
}
If I add one of the lines:
setFilledAndAdd(oval, color, x, y);
Compile time error apears in line obj.setFilled(true);
and lineobj.setFillColor(col);
. Because Shape
is not Fillable
. Undefined for the type Shape.
Changing argument type in method setFilledAndAdd
for Fillable
(not Shape
) leads to compile time error in line add(obj, x, y);
. It needs Shape
in this case.
All children of Shape
I use are Fillable
. Give me a hint, how to get this method working.
Thanks.
Aucun commentaire:
Enregistrer un commentaire